Created
January 24, 2017 22:19
-
-
Save bjouhier/7d660269b6fae13b7e33081d391c665d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("script begin"); | |
var Fiber = require('fibers'); | |
Fiber(function() { | |
var fiber = Fiber.current; | |
setTimeout(function() { | |
console.log("setTimeout callback begin"); | |
fiber.run(); | |
console.log("setTimeout callback end"); | |
}, 10000) | |
console.log(">>> before Fiber.yield()"); | |
Fiber.yield(); | |
console.log(">>> after Fiber.yield()"); | |
}).run(); | |
setInterval(function() { | |
console.log("setInterval callback"); | |
}, 1000); | |
console.log("script end"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: