I see…
Meteor.startup ->
Meteor.defer ->
Appreciate advice as to what this does.
It means defer everything in the Meteor.defer(function () { ... })
block until after all the other commands in the event loop have been run (like a setTimeout
with a time of 0
).
Meteor.defer(function () {
console.log('A');
});
console.log('B');
will return:
--> B
--> A
The Meteor.startup
part just means: don’t run the commands inside this code block until all the code from the app and all its packages has loaded (i.e. all functions, variables, etc., are ready to be used).
2 Likes
I went to coffee shop the other day. The barista was busy getting cups from the dishwasher. I called “hey, when you’re ready I’ll have a skinny latte.” Sure enough as soon as she had finisnhed unloading the dishwasher she made my coffee and bought it over.
True story.
Barista.defer(function(){
Barista.order("skinny latte");
});
8 Likes