Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
tonic + npm: fibers
node v6.17.1
endpoint
share
tweet
var Future = require("fibers/future") var sleep = ms => { var future = new Future setTimeout(function() { future.return() }, ms) return future } Future.task( ()=> { console.time( 'serial' ) sleep(100).wait() sleep(100).wait() console.timeEnd( 'serial' ) console.time( 'parallel' ) var s1 = sleep(100) var s2 = sleep(100) s1.wait() s2.wait() console.timeEnd( 'parallel' ) }).detach()
Created from: https://tonicdev.com/npm/fibers
Loading…
no comments
sign in
to comment