]> _ Git - fluidbook-html5.git/commitdiff
#1346
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 13 Apr 2017 17:13:08 +0000 (19:13 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 13 Apr 2017 17:13:08 +0000 (19:13 +0200)
js/libs/orientationchangeend.js [deleted file]

diff --git a/js/libs/orientationchangeend.js b/js/libs/orientationchangeend.js
deleted file mode 100644 (file)
index df18b86..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-var Event,
-    Sister = require('sister');
-
-Event = function Event (config) {
-    var event,
-        lastEnd,
-        eventEmitter;
-
-    if (!(this instanceof Event)) {
-        return new Event(config);
-    }
-
-    eventEmitter = Sister();
-
-    event = this;
-    event.on = eventEmitter.on;
-
-    config = config || {};
-
-    /**
-     * @var {Number} Number of iterations the subject of interval inspection must not mutate to fire "orientationchangeend".
-     */
-    config.noChangeCountToEnd = config.noChangeCountToEnd || 100;
-    /**
-     * @var {Number} Number of milliseconds after which fire the "orientationchangeend" if interval inspection did not do it before.
-     */
-    config.noEndTimeout = 1000 || config.noEndTimeout;
-    /**
-     * @var {Boolean} Enables logging of the events.
-     */
-    config.debug = config.debug || false;
-
-    global
-        .addEventListener('orientationchange', function () {
-            var interval,
-                timeout,
-                end,
-                lastInnerWidth,
-                lastInnerHeight,
-                noChangeCount;
-
-            end = function (dispatchEvent) {
-                clearInterval(interval);
-                clearTimeout(timeout);
-
-                interval = null;
-                timeout = null;
-
-                if (dispatchEvent) {
-                    eventEmitter.trigger('orientationchangeend');
-                }
-            };
-
-            // If there is a series of orientationchange events fired one after another,
-            // where n event orientationchangeend event has not been fired before the n+2 orientationchange,
-            // then orientationchangeend will fire only for the last orientationchange event in the series.
-            if (lastEnd) {
-                lastEnd(false);
-            }
-
-            lastEnd = end;
-
-            interval = setInterval(function () {
-                if (global.innerWidth === lastInnerWidth && global.innerHeight === lastInnerHeight) {
-                    noChangeCount++;
-
-                    if (noChangeCount === config.noChangeCountToEnd) {
-                        if (config.debug) {
-                            console.debug('setInterval');
-                        }
-
-                        end(true);
-                    }
-                } else {
-                    lastInnerWidth = global.innerWidth;
-                    lastInnerHeight = global.innerHeight;
-                    noChangeCount = 0;
-                }
-            });
-            timeout = setTimeout(function () {
-                if (config.debug) {
-                    console.debug('setTimeout');
-                }
-
-                end(true);
-            }, config.noEndTimeout);
-        });
-}
-
-global.gajus = global.gajus || {};
-global.gajus.orientationchangeend = Event;
-
-module.exports = Event;
\ No newline at end of file