 		 * @private
 		 * @param {Function} fn The flush task.
 		###
-		scheduleFlush = do ->
-			doc = root.document
-
+		scheduleFlush = Yaku.nextTick or do ->
 			try
-				nextTick = root.process.nextTick
-				return ->
-					nextTick flush
-					return
-
-			if nextTick = root.setImmediate
-				->
-					nextTick flush
-					return
-
-			else if mutationObserver = root.MutationObserver
-				content = 1
-				node = doc.createTextNode ''
-				observer = new mutationObserver flush
-				observer.observe node, characterData: true
-				->
-					node.data = (content = -content)
-					return
-
-			else
-				->
-					setTimeout flush
-					return
+				root.process.nextTick
+			catch
+				setTimeout
 
 		(p, v) ->
 			fnQueue[fnQueueLen++] = p
 			fnQueue[fnQueueLen++] = v
 
-			scheduleFlush() if fnQueueLen == 2
+			scheduleFlush flush if fnQueueLen == 2
 
 			return
 


do -> class Yaku
	'use strict'

	root = if typeof global == 'object'
		global
	else
		window

	###*
	 * This class follows the [Promises/A+](https://promisesaplus.com) and

	 * @param {Yaku} p1
	 * @param {Yaku} p2
	###
	scheduleHandler = genScheduler 999, (p1, p2) ->
		handler = if p1._state then p2._onFulfilled else p2._onRejected

		# 2.2.7.3
