diff options
Diffstat (limited to 'native_client_sdk/src/examples/common.js')
-rw-r--r-- | native_client_sdk/src/examples/common.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/native_client_sdk/src/examples/common.js b/native_client_sdk/src/examples/common.js index a457715..257773c 100644 --- a/native_client_sdk/src/examples/common.js +++ b/native_client_sdk/src/examples/common.js @@ -29,7 +29,8 @@ var common = (function () { moduleEl.setAttribute('src', path + '/' + name + '.nmf'); // For NaCL modules use application/x-nacl. var mimetype = 'application/x-nacl'; - if (tool == 'win' || tool == 'linux' || tool == 'mac') { + var isHost = tool == 'win' || tool == 'linux' || tool == 'mac'; + if (isHost) { // For non-nacl PPAPI plugins use the x-ppapi-debug/release // mime type. if (path.toLowerCase().indexOf('release') != -1) @@ -46,6 +47,15 @@ var common = (function () { // event fires. var listenerDiv = document.getElementById('listener'); listenerDiv.appendChild(moduleEl); + + // Host plugins don't send a moduleDidLoad message. We'll fake it here. + if (isHost) { + window.setTimeout(function () { + var evt = document.createEvent('Event'); + evt.initEvent('load', true, true); // bubbles, cancelable + moduleEl.dispatchEvent(evt); + }, 100); // 100 ms + } } /** |