Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ See docs/process.md for more on how version tagging works.

5.0.1 (in development)
----------------------
- The (undocumented) Module.requestAnimationFrame, Module.pauseMainLoop and
Module.resumeMainLoop methods are no longer exported by default but must
be added to `-sEXPORTED_RUNTIME_METHODS`. ()
- `logReadFiles` was removed from the default `INCOMING_MODULE_JS_API` list.
To use this feature you now need to explictly add `logReadFiles` to
`INCOMING_MODULE_JS_API`. (#26190);
Expand Down
17 changes: 12 additions & 5 deletions src/lib/libeventloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,20 @@ LibraryJSEventLoop = {
typeof MainLoop != 'undefined' && MainLoop.preMainLoop.push(f);
},

$requestAnimationFrame__docs: `
/**
* @suppress {duplicate, checkTypes}
*/`,
$requestAnimationFrame__deps: ['$MainLoop'],
$requestAnimationFrame: 'MainLoop.requestAnimationFrame',
$pauseMainLoop__deps: ['$MainLoop'],
$pauseMainLoop: 'MainLoop.pause',
$resumeMainLoop__deps: ['$MainLoop'],
$resumeMainLoop: 'MainLoop.resume',

$MainLoop__internal: true,
$MainLoop__deps: ['$setMainLoop', '$callUserCallback', 'emscripten_set_main_loop_timing'],
$MainLoop__postset: `
Module['requestAnimationFrame'] = MainLoop.requestAnimationFrame;
Module['pauseMainLoop'] = MainLoop.pause;
Module['resumeMainLoop'] = MainLoop.resume;
MainLoop.init();`,
$MainLoop__postset: `MainLoop.init();`,
$MainLoop: {
running: false,
scheduler: null,
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_O0.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 24268,
"a.out.js.gz": 8718,
"a.out.js": 24319,
"a.out.js.gz": 8732,
"a.out.nodebug.wasm": 15138,
"a.out.nodebug.wasm.gz": 7455,
"total": 39406,
"total_gz": 16173,
"total": 39457,
"total_gz": 16187,
"sent": [
"fd_write"
],
Expand Down
4 changes: 2 additions & 2 deletions test/codesize/test_codesize_hello_dylink_all.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"a.out.js": 244700,
"a.out.js": 244558,
"a.out.nodebug.wasm": 577696,
"total": 822396,
"total": 822254,
"sent": [
"IMG_Init",
"IMG_Load",
Expand Down
3 changes: 3 additions & 0 deletions test/codesize/test_codesize_minimal_O0.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,9 @@ missingLibrarySymbols.forEach(missingLibrarySymbol)
'emSetImmediate',
'emClearImmediate_deps',
'emClearImmediate',
'requestAnimationFrame',
'pauseMainLoop',
'resumeMainLoop',
'promiseMap',
'Browser',
'requestFullscreen',
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_O0.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19498,
"a.out.js.gz": 7013,
"a.out.js": 19549,
"a.out.js.gz": 7027,
"a.out.nodebug.wasm": 1136,
"a.out.nodebug.wasm.gz": 656,
"total": 20634,
"total_gz": 7669,
"total": 20685,
"total_gz": 7683,
"sent": [],
"imports": [],
"exports": [
Expand Down
12 changes: 6 additions & 6 deletions test/codesize/test_unoptimized_code_size.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"hello_world.js": 56965,
"hello_world.js.gz": 17729,
"hello_world.js": 57031,
"hello_world.js.gz": 17743,
"hello_world.wasm": 15138,
"hello_world.wasm.gz": 7455,
"no_asserts.js": 26576,
"no_asserts.js.gz": 8881,
"no_asserts.wasm": 12187,
"no_asserts.wasm.gz": 5984,
"strict.js": 54881,
"strict.js.gz": 17045,
"strict.js": 54947,
"strict.js.gz": 17060,
"strict.wasm": 15138,
"strict.wasm.gz": 7450,
"total": 180885,
"total_gz": 64544
"total": 181017,
"total_gz": 64573
}
16 changes: 16 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -15438,3 +15438,19 @@ def test_logReadFiles(self):
create_file('pre.js', 'Module.logReadFiles = 1;')
output = self.do_runf('checksummer.c', args=['test.txt'], cflags=['--pre-js=pre.js'])
self.assertContained('read file: /test.txt', output)

def test_request_animation_frame(self):
create_file('test.c', r'''
#include <emscripten.h>
#include <stdio.h>

int main() {
EM_ASM({
Module.requestAnimationFrame(() => console.log('got RAF'));
});
printf("done\n");
}
''')
self.do_runf('test.c', "Aborted('requestAnimationFrame' was not exported", assert_returncode=NON_ZERO)
# Once added to EXPORTED_RUNTIME_METHODS it should be callable.
self.do_runf('test.c', "done\ngot RAF\n", cflags=['-sEXPORTED_RUNTIME_METHODS=requestAnimationFrame'])