![]() ![]() Exporting a function: module.exports = () =>.But I liked the explicit elaboration of 5 module definition patterns in CommonJS: I am superficially familiar with the differences between CommonJS modules and ES Modules. The Reactor pattern, together with demultiplexing, event queues and the event loop, is core to how this works - a tightly coordinated dance of feeding async events into a single queue, executing them as resources free up, and then popping them off the event queue to call callbacks given by user code. ![]() ![]() Other than abstracting the underlying system calls, libuv also implements the reactor pattern, thus providing an API for creating event loops, managing the event queue, running asynchronous I/O operations, and queuing other types of task. Libuv represents the low-level I/O engine of Node.js and is probably the most important component that Node.js is built on. Libuv is something I’ve often heard about as a low level Node.js library, but now I have a glimpse of what it does for us. The first 6 chapters cover fundamental knowledge, before getting into the meaty named Design Patterns, so these notes are from that first “half” of the book. I got the Third Edition, and have not spent any time looking into what’s changed from prior editions. I started reading Node.js Design Patterns this week. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |