Skip to content

Instantly share code, notes, and snippets.

@acidsound
Created February 11, 2014 06:01
Show Gist options
  • Save acidsound/8929935 to your computer and use it in GitHub Desktop.
Save acidsound/8929935 to your computer and use it in GitHub Desktop.
Future Example on Meteor (server-side only)
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