diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-22 17:09:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-22 17:09:02 -0800 |
commit | 7dfbd9ac5ec8d096cbc147d7693814d2d81568bc (patch) | |
tree | baa38c9f0c8cc62d480ca486cc90b13a755762a2 | |
parent | 00c0ccc15b36742bdbb472ce09b1eae7616e822f (diff) |
some headless additions
-rw-r--r-- | src/headless.js | 12 | ||||
-rw-r--r-- | src/headlessCanvas.js | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/headless.js b/src/headless.js index e5458641..5880c087 100644 --- a/src/headless.js +++ b/src/headless.js @@ -82,6 +82,16 @@ var window = { } listeners.push(func); }, + removeEventListener: function(id, func) { + var listeners = this.eventListeners[id]; + if (!listeners) return; + for (var i = 0; i < listeners.length; i++) { + if (listeners[i] === func) { + listeners.splice(i, 1); + return; + } + } + }, callEventListeners: function(id) { var listeners = this.eventListeners[id]; if (listeners) { @@ -101,6 +111,7 @@ var document = { headless: true, eventListeners: {}, addEventListener: window.addEventListener, + removeEventListener: window.removeEventListener, callEventListeners: window.callEventListeners, getElementById: function(id) { switch(id) { @@ -144,6 +155,7 @@ var document = { }, eventListeners: {}, addEventListener: document.addEventListener, + removeEventListener: document.removeEventListener, callEventListeners: document.callEventListeners, }; }; diff --git a/src/headlessCanvas.js b/src/headlessCanvas.js index 4951aed8..6b0f9d47 100644 --- a/src/headlessCanvas.js +++ b/src/headlessCanvas.js @@ -600,6 +600,7 @@ function headlessCanvas() { style: {}, eventListeners: {}, addEventListener: function(){}, + removeEventListener: function(){}, requestFullScreen: function() { document.fullscreenElement = document.getElementById('canvas'); window.setTimeout(function() { |