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.

prevent fetch from not running

+8 -6
+2 -2
examples/server/server.js
··· 29 29 30 30 router.insert('/status', async c => { 31 31 await new Promise(resolve => setTimeout(resolve, 1000)); 32 - const result = await Promise.resolve('Hello'); 33 - // const result = (await fetch('http://localhost:8000/meow')).text(); 32 + // const result = await Promise.resolve('Hello'); 33 + const result = (await fetch('http://localhost:8000/meow')).text(); 34 34 return c.res.body(`server is responding with ${result}`); 35 35 }); 36 36
+1
include/runtime.h
··· 7 7 struct js *js; 8 8 jsval_t ant_obj; 9 9 int crypto_initialized; 10 + int external_event_loop_active; 10 11 }; 11 12 12 13 extern struct ant_runtime *const rt;
+1 -1
meson.build
··· 67 67 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 68 68 69 69 version_conf = configuration_data() 70 - version_conf.set('ANT_VERSION', '0.0.6.26') 70 + version_conf.set('ANT_VERSION', '0.0.6.27') 71 71 version_conf.set('ANT_GIT_HASH', git_hash) 72 72 version_conf.set('ANT_BUILD_DATE', build_date) 73 73
+1 -2
src/modules/fetch.c
··· 325 325 } 326 326 327 327 void fetch_poll_events(void) { 328 - if (fetch_loop && fetch_loop == uv_default_loop()) return; 329 - 328 + if (fetch_loop && fetch_loop == uv_default_loop() && rt->external_event_loop_active) return; 330 329 if (fetch_loop && uv_loop_alive(fetch_loop)) { 331 330 uv_run(fetch_loop, UV_RUN_ONCE); 332 331 if (pending_requests && utarray_len(pending_requests) > 0) usleep(1000);
+2 -1
src/modules/server.c
··· 541 541 } 542 542 543 543 server->pending_responses = NULL; 544 - 545 544 uv_timer_init(g_loop, &g_js_timer); 545 + 546 546 g_js_timer.data = js; 547 + rt->external_event_loop_active = 1; 547 548 548 549 while (uv_loop_alive(g_loop)) { 549 550 if (has_pending_timers()) {
+1
src/runtime.c
··· 14 14 runtime.js = js; 15 15 runtime.ant_obj = js_mkobj(js); 16 16 runtime.crypto_initialized = 0; 17 + runtime.external_event_loop_active = 0; 17 18 18 19 js_set(js, js_glob(js), "Ant", runtime.ant_obj); 19 20