content in my comments and updated any time
-
-
Save ShiYuanjun-Tim/d416633549f320933507feb1fdee64c3 to your computer and use it in GitHub Desktop.
NodeJS
Well, in node everything runs in parallel, except your code.
EventLoop Related
Offical explainantion 👋 !
give you the concept Concurrency model and Event Loop!
get the `stack` , `heap`, `queue`
The JavaScript Event Loop [Presentation]!
webworker
allows you to offload work to a separate thread. coolPhilip Roberts: What the heck is the event loop anyway?! Or text verison Here!
how the
block
happen ,stack exceed the maxizme size
The JavaScript Event Loop: Explained!
Check the Pic!
Event loop and others from Stackoverflow QA1 is great answer!
what is a `tick` mean ,
What is the Node.js single-threaded event loop? link1!, link2!
Any time something happens in a NodeJS application, an event is created.New events are loaded onto the event queue. These events are processed serially. The event loop takes events from the head of the event queue one at a time and hands them off to the file system, network, or another process.
As those events are processed, they create more events. Those new events are placed at the back of the event queue, and the cycle continues.
nextTick() Vs setImmediate
also!
check the last pragraph in answer!
In the nextTick example, we end up executing all the nextTick callbacks before ever returning to the event loop. Since setTimeout's callback will be called from the event loop, the text 'TIMEOUT FIRED' will not be output until we're done with every nextTick callback.
Angular
The "Magic" behind AngularJS Dependency Injection (TAG:DI )!
controller=function($http,$scope){...}
controller=['$http','$scope',function(a,v){...}]
in case 1, it use the toString method of the function to get the parameter declaration and then store the computing result to $inject property of the function for later use, these names can be used to map to the angular services
But When minified the parameter names are mangled to e or t so cannot be mapped to service names by angular. so the array form of case 2 is used to avoid this.