You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
528 B
CoffeeScript

$ = require "jquery"
domInitialized = false
queue = []
$ ->
domInitialized = true
queue.forEach ([thisArg, func, args]) ->
console.log args
func.apply(thisArg, args)
queue = []
domWait = (thisArg, func, args) ->
if domInitialized
func.apply(thisArg, args)
else
queue.push [thisArg, func, args]
domWait.func = (func) ->
return ->
args = []
# This is needed to avoid killing the optimizer.
for i in [0...arguments.length]
args[i] = arguments[i]
domWait(this, func, args)
module.exports = domWait