How it feels to learn Javascript in 2016

Or, you could use Meteor, Blaze, an Atmosphere package for REST, and be done in, what? 100 lines of code? 50?

11 Likes

lol thats great. had to share on twitter.

Blaze is soooo 2014. /s

2 Likes

Case in point, because I was bored:

Fetches some latest photos from Flickr XML API and displays them in a real-time updated table. Done with less than 50 lines of JS code in 30 minutes from start to finish.

Of course it’s a crude example and if that was a real-world component I probably would write it differently, but it really shows how Meteor can get things done quickly and easily.

4 Likes

Just a question because I don’t understand this properly myself…

Why did you wrap this in Meteor.startup?
I’ve never done this myself and don’t understand why people do it.
As I understand it, main.js will only run once, on startup anyway?

Not sure if it’s needed here, but as I understand wrapping your initialization code in Meteor.startup() makes sure that it gets executed only after everything else got loaded (all the JS files etc.).

1 Like

Ah so it basically puts that block of code on hold until the rest of the server code has completed execution.

I guess that it would be useful if you don’t have control of the loading order, or if you have a complex load order and just want something to run at the very end.

Cheers :slight_smile: