ng-conf 2014

Zone.js y AngularJS

Brian Ford  · 

Presentación

HTML (pincha para descargar)

Vídeo

Código de la presentación

Puedes acceder al código fuente utilizado en esta presentación en el siguiente enlace:

https://github.com/angular/zone.js

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

so I'm Brian and I work on the angularjs core team at Google and thank you all right all right I'm flattered all right I'm flattered but before we get started I have I have just one thing to do here there we go I haven't pushed any code and

I want my like github graph to be nice I have to push this upstream - yes there we go all right see look at that I'm a really responsible person all right and then one last other order of business I have to tweet and then you also you got to get your retweets

into so we're doing all right all right all right now we're really ready to go so like I said I'm Brian I'm the social media expert on angular and I'm going to be talking about zones this is the the enigmatic talk that my colleagues have

been alluding to so it's totally overhyped and I'm pretty sure you're going to be disappointed but bear with me okay so so what is zone J s if any of you are familiar with the with node it's it's actually kind of like domains in there it's

kind of like it just get an idea in your head if you've used Java it's it's kind of like thread locals in Java the implications are a little bit different but just to prime your brain and it's also in Dart I know dart has a lot of haters but

it's in Dart and it's a it's a good feature and so zone J s is a port of this awesome dart feature to JavaScript this is just one of the many ways that dart is actually like helping us on the Jas IDE but but according to me show this this was a

an excellent quote by him when I was going over slides he said it's like open heart surgery on the web browser and the reason is that the implementation is is kind of crazy we won't worry about that too much in here but hopefully you'll see that

you have to do some powerful stuff in order to get this kind of feature alright so what is the zone all right you ready guys the big reveal it's an execution context talk over right yeah all right so what what what on earth do I mean by something nebulous

like this it really only makes sense if we like take a step back and we go back to like JavaScript 101 and we think about how javascript is asynchronous and how this kind of works so here's here's some code on the left very interesting code it's

you know we're calling set timeout where we're running some functions that do some arbitrary things but really what I want to think about is the the order that these things happen right so we we know what what this will do but let's let's step

through it all right so a will be invoked will have set timeout on B so B gets added to this Q this is a task that will be run later and so if you know how like the the event loop in the browser works you know that as soon as we're done here these things

that were queuing up B and C will run after we've reached the end of this task on the left this block of synchronous code right so now B and then C right okay yeah super cool Brian just taught us JavaScript awesome but the the implications of this are

[ ... ]

Nota: se han omitido las otras 1.537 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.