Electron Internals: Integración de bucle de mensaje
This is the first post of a series that explains the internals of Electron. This post introduces how Node's event loop is integrated with Chromium in Electron.
Ha habido muchos intentos de usar Node para programación GUI, como node-gui para enlaces GTK+ y node-qt para enlaces QT. But none of them work in production because GUI toolkits have their own message loops while Node uses libuv for its own event loop, and the main thread can only run one loop at the same time. So the common trick to run GUI message loop in Node is to pump the message loop in a timer with very small interval, which makes GUI interface response slow and occupies lots of CPU resources.
During the development of Electron we met the same problem, though in a reversed way: we had to integrate Node's event loop into Chromium's message loop.