kopia lustrzana https://github.com/micropython/micropython
webassembly: Move MP_JS_EPOCH init to library postset.
This eliminates the need for wrapper.js to run to set up the time. Signed-off-by: Damien George <damien@micropython.org>pull/13583/head
rodzic
ff15dfcaa8
commit
8282bd93a2
|
@ -35,9 +35,10 @@ mergeInto(LibraryManager.library, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mp_js_ticks_ms: function() {
|
// This string will be emitted directly into the output file by Emscripten.
|
||||||
return Date.now() - MP_JS_EPOCH;
|
mp_js_ticks_ms__postset: "var MP_JS_EPOCH = Date.now()",
|
||||||
},
|
|
||||||
|
mp_js_ticks_ms: () => Date.now() - MP_JS_EPOCH,
|
||||||
|
|
||||||
mp_js_hook: function() {
|
mp_js_hook: function() {
|
||||||
if (ENVIRONMENT_IS_NODE) {
|
if (ENVIRONMENT_IS_NODE) {
|
||||||
|
|
|
@ -33,8 +33,6 @@ var mainProgram = function()
|
||||||
mp_js_init_repl = Module.cwrap('mp_js_init_repl', 'null', ['null']);
|
mp_js_init_repl = Module.cwrap('mp_js_init_repl', 'null', ['null']);
|
||||||
mp_js_process_char = Module.cwrap('mp_js_process_char', 'number', ['number'], {async: true});
|
mp_js_process_char = Module.cwrap('mp_js_process_char', 'number', ['number'], {async: true});
|
||||||
|
|
||||||
MP_JS_EPOCH = Date.now();
|
|
||||||
|
|
||||||
if (typeof window === 'undefined' && require.main === module) {
|
if (typeof window === 'undefined' && require.main === module) {
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var heap_size = 128 * 1024;
|
var heap_size = 128 * 1024;
|
||||||
|
|
Ładowanie…
Reference in New Issue