       tasks.set(handle = getHandle(), f)
       container.postMessage(prefix+handle, "*")
       handle
+    Batman.clearImmediate = (handle) -> tasks.unset(handle)
   else if typeof document isnt 'undefined' && "onreadystatechange" in document.createElement("script")
-    usingTasks = true
-
     Batman.setImmediate = (f) ->
       handle = getHandle()
       script = document.createElement("script")

        script = null
      document.documentElement.appendChild(script)
      handle
  else if process?.nextTick
    functions = {}
    Batman.setImmediate = (f) ->


  if container.setImmediate
    Batman.setImmediate = container.setImmediate
    Batman.clearImmediate = container.clearImmediate
  else if container.msSetImmediate
    Batman.setImmediate = msSetImmediate
    Batman.clearImmediate = msClearImmediate
  else if canUsePostMessage()
    prefix = 'com.batman.'
    functions = new Batman.SimpleHash
    handler = (e) ->
