MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

emit beforeExit event

+9 -1
+1
include/modules/process.h
··· 5 5 6 6 void process_gc_update_roots(GC_OP_VAL_ARGS); 7 7 void process_enable_keypress_events(void); 8 + void emit_process_event(const char *event_type, jsval_t *args, int nargs); 8 9 9 10 void init_process_module(void); 10 11 bool has_active_stdin(void);
+1 -1
src/modules/process.c
··· 257 257 ); 258 258 } 259 259 260 - static void emit_process_event(const char *event_type, jsval_t *args, int nargs) { 260 + void emit_process_event(const char *event_type, jsval_t *args, int nargs) { 261 261 if (!rt->js) return; 262 262 263 263 ProcessEventType *evt = NULL;
+7
src/reactor.c
··· 58 58 return flags; 59 59 } 60 60 61 + static void process_before_exit(ant_t *js) { 62 + jsval_t code = js_mknum(0); 63 + emit_process_event("beforeExit", &code, 1); 64 + if ((get_pending_work() & WORK_PENDING) || UV_CHECK_ALIVE) js_run_event_loop(js); 65 + } 66 + 61 67 void js_run_event_loop(ant_t *js) { 62 68 work_flags_t work; 63 69 int uv_alive = UV_CHECK_ALIVE; ··· 76 82 } 77 83 78 84 js_poll_events(js); 85 + process_before_exit(js); 79 86 }