From 7dfbd9ac5ec8d096cbc147d7693814d2d81568bc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 22 Jan 2014 17:09:02 -0800 Subject: some headless additions --- src/headless.js | 12 ++++++++++++ src/headlessCanvas.js | 1 + 2 files changed, 13 insertions(+) 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() { -- cgit v1.2.3-18-g5258