diff options
Diffstat (limited to 'examples/emscripten-example-js-library.js')
-rw-r--r-- | examples/emscripten-example-js-library.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/emscripten-example-js-library.js b/examples/emscripten-example-js-library.js new file mode 100644 index 00000000..fbb3f5e1 --- /dev/null +++ b/examples/emscripten-example-js-library.js @@ -0,0 +1,19 @@ +//"use strict"; + +var LibraryEXAMPLE = { + $EXAMPLE__deps: ['$Browser'], + $EXAMPLE: { + receiveEvent: function(event) { + Browser.mainLoop.resume(); + }, + }, + example_js_add_input_listener: function() { + ['mousedown', 'mouseup', 'mousemove', 'DOMMouseScroll', + 'mousewheel', 'mouseout'].forEach(function(event) { + Module['canvas'].addEventListener(event, EXAMPLE.receiveEvent, true); + }); + } +}; + +autoAddDeps(LibraryEXAMPLE, '$EXAMPLE'); +mergeInto(LibraryManager.library, LibraryEXAMPLE); |