From 32d9a1549d7d8d041f238fe00bba0cc21f5913c0 Mon Sep 17 00:00:00 2001 From: vitorsemeano Date: Wed, 27 Feb 2019 00:10:31 +0000 Subject: [PATCH] removed all unecessary polifys --- src/components/polyfills/array.js | 25 ------------------- src/components/polyfills/bind.js | 27 --------------------- src/components/polyfills/objectassign.js | 23 ------------------ src/components/polyfills/raf.js | 31 ------------------------ src/scripts/site.js | 20 --------------- 5 files changed, 126 deletions(-) delete mode 100644 src/components/polyfills/array.js delete mode 100644 src/components/polyfills/bind.js delete mode 100644 src/components/polyfills/objectassign.js delete mode 100644 src/components/polyfills/raf.js diff --git a/src/components/polyfills/array.js b/src/components/polyfills/array.js deleted file mode 100644 index 5caea62e3b..0000000000 --- a/src/components/polyfills/array.js +++ /dev/null @@ -1,25 +0,0 @@ -if (!Array.prototype.filter) { - Array.prototype.filter = function (fun /*, thisp*/) { - "use strict"; - - if (this == null) - throw new TypeError(); - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun != "function") - throw new TypeError(); - - var res = []; - var thisp = arguments[1]; - for (var i = 0; i < len; i++) { - if (i in t) { - var val = t[i]; // in case fun mutates this - if (fun.call(thisp, val, i, t)) - res.push(val); - } - } - - return res; - }; -} \ No newline at end of file diff --git a/src/components/polyfills/bind.js b/src/components/polyfills/bind.js deleted file mode 100644 index 82495aa103..0000000000 --- a/src/components/polyfills/bind.js +++ /dev/null @@ -1,27 +0,0 @@ -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== 'function') { - // closest thing possible to the ECMAScript 5 - // internal IsCallable function - throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () { }, - fBound = function () { - return fToBind.apply(this instanceof fNOP - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - if (this.prototype) { - // Function.prototype doesn't have a prototype property - fNOP.prototype = this.prototype; - } - fBound.prototype = new fNOP(); - - return fBound; - }; -} \ No newline at end of file diff --git a/src/components/polyfills/objectassign.js b/src/components/polyfills/objectassign.js deleted file mode 100644 index 2ea96b188d..0000000000 --- a/src/components/polyfills/objectassign.js +++ /dev/null @@ -1,23 +0,0 @@ -if (typeof Object.assign != 'function') { - (function () { - Object.assign = function (target) { - 'use strict'; - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== undefined && source !== null) { - for (var nextKey in source) { - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; - }; - })(); -} \ No newline at end of file diff --git a/src/components/polyfills/raf.js b/src/components/polyfills/raf.js deleted file mode 100644 index 2c7c433329..0000000000 --- a/src/components/polyfills/raf.js +++ /dev/null @@ -1,31 +0,0 @@ -// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ -// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating - -// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel - -// MIT license - -(function () { - var lastTime = 0; - var vendors = ['ms', 'moz', 'webkit', 'o']; - for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; - window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] - || window[vendors[x] + 'CancelRequestAnimationFrame']; - } - - if (!window.requestAnimationFrame) - window.requestAnimationFrame = function (callback, element) { - var currTime = new Date().getTime(); - var timeToCall = Math.max(0, 16 - (currTime - lastTime)); - var id = window.setTimeout(function () { callback(currTime + timeToCall); }, - timeToCall); - lastTime = currTime + timeToCall; - return id; - }; - - if (!window.cancelAnimationFrame) - window.cancelAnimationFrame = function (id) { - clearTimeout(id); - }; -}()); \ No newline at end of file diff --git a/src/scripts/site.js b/src/scripts/site.js index d960ccb40d..05770be6ae 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -491,22 +491,6 @@ var AppInfo = {}; promises.push(require(["fetch"])); } - if ("function" != typeof Object.assign) { - promises.push(require(["objectassign"])); - } - - if (!Array.prototype.filter) { - promises.push(require(["arraypolyfills"])); - } - - if (!Function.prototype.bind) { - promises.push(require(["functionbind"])); - } - - if (!window.requestAnimationFrame) { - promises.push(require(["raf"])); - } - Promise.all(promises).then(function () { createConnectionManager().then(function () { console.log("initAfterDependencies promises resolved"); @@ -867,10 +851,6 @@ var AppInfo = {}; define("dashboardcss", ["css!css/dashboard"], returnFirstDependency); define("slideshow", [componentsPath + "/slideshow/slideshow"], returnFirstDependency); define("fetch", [bowerPath + "/fetch/fetch"], returnFirstDependency); - define("raf", [componentsPath + "/polyfills/raf"], returnFirstDependency); - define("functionbind", [componentsPath + "/polyfills/bind"], returnFirstDependency); - define("arraypolyfills", [componentsPath + "/polyfills/array"], returnFirstDependency); - define("objectassign", [componentsPath + "/polyfills/objectassign"], returnFirstDependency); define("clearButtonStyle", ["css!" + componentsPath + "/clearbutton"], returnFirstDependency); define("userdataButtons", [componentsPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency); define("emby-playstatebutton", [componentsPath + "/userdatabuttons/emby-playstatebutton"], returnFirstDependency);