ioBroker.js-controller
ioBroker.js-controller copied to clipboard
Consider using zone.js for compact mode
Zone.js allows us to capture all calls to the outside of the actual adapter code and its dependencies (setTimeout, setInterval and many more) as well as getting notified when a task is being scheduled and executed.
Except for a few native NodeJS synchronous APIs (child_process, file system and perhaps a few more), all execution that is "delayed" happens through the event loop and Zone.js allows to intercept these calls.
Tiny example repo: https://github.com/JiaLiPassion/zone-node
Notice the following line which is using setTimeout() like any other code, but it actually calls into the Zone.js code:
https://github.com/JiaLiPassion/zone-node/blob/a778c9ed4d4d2ade4b10430f3a57a75e32480f7d/nodetest.js#L22
This is related to #1647