Created
February 11, 2014 06:01
-
-
Save acidsound/8929935 to your computer and use it in GitHub Desktop.
Future Example on Meteor (server-side only)
This file contains 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
Future = Npm.require('fibers/future'); | |
Meteor.methods({ | |
'future':function() { | |
console.log('future start:'+Date.now()); | |
var fut = new Future(); | |
Meteor.setTimeout(function() { | |
console.log('callback end:'+Date.now()); | |
fut.return('yahoo:'+Date.now()); | |
}, 1000); | |
console.log('future end:'+Date.now()); | |
return fut.wait(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment