aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-20 10:40:26 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-03-20 10:40:26 -0700
commit5709c2a9aeefef46717ed18bf750bf8b22c3a34c (patch)
tree99eb8907c947f6b9f29cabceae7bc9da96374d55
parent4b4e8582dd7312062d5d19c7856101aae920ccee (diff)
refactor Browser initialization
-rw-r--r--src/library.js2
-rw-r--r--src/library_browser.js10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/library.js b/src/library.js
index 382c21ad..aebad63b 100644
--- a/src/library.js
+++ b/src/library.js
@@ -382,7 +382,7 @@ LibraryManager.library = {
// do preloading for the Image/Audio part, as if the typed array were the
// result of an XHR that you did manually.
createPreloadedFile: function(parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile) {
- Browser.ensureObjects();
+ Browser.init();
var fullname = FS.joinPath([parent, name], true);
function processData(byteArray) {
function finish(byteArray) {
diff --git a/src/library_browser.js b/src/library_browser.js
index 5526456a..e61f84b5 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -45,9 +45,9 @@ mergeInto(LibraryManager.library, {
moduleContextCreatedCallbacks: [],
workers: [],
- ensureObjects: function() {
- if (Browser.ensured) return;
- Browser.ensured = true;
+ init: function() {
+ if (Browser.initted) return;
+ Browser.initted = true;
try {
new Blob();
Browser.hasBlobConstructor = true;
@@ -194,7 +194,8 @@ mergeInto(LibraryManager.library, {
};
Module['preloadPlugins'].push(audioPlugin);
- // is this the right place?
+ // Canvas event setup
+
var canvas = Module['canvas'];
canvas.requestPointerLock = canvas['requestPointerLock'] ||
canvas['mozRequestPointerLock'] ||
@@ -300,6 +301,7 @@ mergeInto(LibraryManager.library, {
Module.ctx = ctx;
Module.useWebGL = useWebGL;
Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() });
+ Browser.init();
}
return ctx;
},