Modules can now subscribe to ESP system events via the new NODEMCU_ESP_EVENT() macro. See nodemcu_esp_event.h for details.