The document discusses the JavaScript event loop and its components, including the call stack, task queue, and vendor APIs. It explains how JavaScript operates in a single-threaded, non-blocking manner, and provides code snippets demonstrating functions like setTimeout and setInterval. Various implementations of JavaScript engines, as well as concepts related to task scheduling and execution contexts, are also highlighted.
Introduction to JavaScript Event Loop, highlighting single-threaded, non-blocking, asynchronous, and concurrent concepts along with call stack, event loop, and task queue.
Various JavaScript implementations including Spidermonkey, JavaScriptCore, V8, and others utilized within different environments like web and Node.js.
Usage of setTimeout and setInterval in JavaScript to handle delayed execution and interactions in both web and Node.js contexts.
Implementation of example code using Johnny Five library for controlling hardware components using Node.js.
In-depth explanation and demonstration of the JavaScript execution contexts, task queues, and event loop processes through example functions.
Exploration of the JavaScript event loop operation, focusing on macro tasks and micro tasks and their execution order.
Detailed mechanisms of the Promise behavior in the event loop along with examples involving setTimeout and requestAnimationFrame.
Explanation of how the HTML specification defines additional task queues in the context of the event loop.
Characteristics of the Node.js event loop, detailing the execution phases and callback processing, particularly the handling of asynchronous operations.
Overall flexibility of JavaScript across environments, concluding with a summary of presentations and references.
Web
var tID =setTimeout(callback, [delay[, ...args]])
var tID = setTimeout(callback, [delay])
var tID = setTimeout(code[, delay])
var iID = setInterval(func, delay[, ...args])
var iID = setInterval(code, delay)
clearTimeout(tID)
clearTimeout(iID)
https://www.w3.org/standards/webdesign/script
13.
Node
var timeout =setTimeout(callback, [delay, [...args]])
var interval = setInterval(callback, [delay, [...args]])
var immediate = setImmediate(callback[, ...args])
clearTimeout(timeout)
clearInterval(interval)
clearImmediate(immediate)
https://nodejs.org/dist/latest-v10.x/docs/api/
GJS
const { mainloop} = imports
mainloop.timeout_add(1, () => log(“Hello World”))
mainloop.timeout_add(1, mainloop.quit)
mainloop.run()
GJSDocs based on GObject Instrospection
16.
Johnny Five
// Blinkan LED
var five = require("johnny-five")
var board = new five.Board()
board.on("ready", function() {
var led = new five.Led(13)
led.blink()
});
http://johnny-five.io/api/led/#usage
http://johnny-five.io/api/
17.
Johnny Five
// Blinkan LED
var five = require("johnny-five")
var board = new five.Board()
board.on("ready", function() {
var led = new five.Led(13)
led.blink()
});
http://johnny-five.io/api/led/#usage
http://johnny-five.io/api/