 
 
 
-# __domComplete = []
-# 
-# document.onreadystatechange = (event) =>
-# 	console.log "onreadystatechange", document.readyState
-# 	
-# 	utils.delay 100, ->
-# 	
-# 		if document.readyState is "complete"
-# 			while __domComplete.length
-# 				__domComplete.shift()()
-# 
-# 		# __domComplete.map (f) -> 
-# 		# 	console.log f
-# 		# 	f()
-# 		# __domComplete = []
-# 
-# exports.domComplete = (f) ->
-# 	if document.readyState is "complete"
-# 		f()
-# 	else
-# 		__domComplete.push f
-# 
-# exports.domCompleteCancel = (f) ->
-# 	__domComplete = _.whithout __domComplete, f
-
-
-
-
-
+__domComplete = []
+
+document.onreadystatechange = (event) =>
+	
+	console.log "document.onreadystatechange", document.readyState
+	
+	if document.readyState is "complete"
+		
+		console.log "__domComplete", __domComplete
+		
+		while __domComplete.length
+			f = __domComplete.shift()
+			
+			if typeof f is "function"
+				console.log "execute", f
+				f()
+
+exports.domComplete = (f) ->
+	
+	if document.readyState is "complete"
+		f()
+	else
+		__domComplete.push f
+
+exports.domCompleteCancel = (f) ->
+	__domComplete = _.without __domComplete, f
+
+
+
+
+

#
# Returns a Function
#
exports.throttle = (fn, delay) ->
	return fn if delay is 0
	timer = false
	return ->

#
# Returns a Function
#
exports.debounce = (threshold, fn, immediate) ->
	timeout = null
	(args...) ->
		obj = this
