vegas-js-polyfill
Version:
A specialized polyfill javascript library for the VEGAS JS libraries.
6 lines (4 loc) • 2.94 kB
JavaScript
/**
* A specialized polyfill javascript library. - version: 1.0.8 - license: MPL 2.0/GPL 2.0+/LGPL 2.1+ - Follow me on Twitter! @ekameleon
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.polyfill={})}(this,function(t){"use strict";Date.now&&Date.prototype.getTime||(Date.now=function(){return(new Date).getTime()}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind called on incompatible "+this);var e=Array.prototype.slice.call(arguments,1),n=this,o=function(){},r=function(){return n.apply(this instanceof o?this:t,e.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(o.prototype=this.prototype),r.prototype=new o,r}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?1:+t}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(null!=o)for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}),function(e){if("function"!=typeof e.Uint32Array){var t=function(t){e[t]=function(t){var e=void 0;if("number"==typeof t)for(Array.call(this,t),this.length=t,e=0;e<this.length;e++)this[e]=0;else for(Array.call(this,t.length),this.length=t.length,e=0;e<this.length;e++)this[e]=t[e]},e[t].prototype=[],e[t].constructor=e[t]};t("Float32Array"),t("Uint32Array"),t("Uint16Array"),t("Int16Array"),t("ArrayBuffer")}}(window||global||{});var e=void 0;try{e=n||null}catch(t){}if(!e)try{e=window}catch(t){}if(!e)try{e=document}catch(t){}e||(e={});var n=e,o=n.performance||{};if(Object.defineProperty(n,"performance",{value:o,configurable:!0,writable:!0}),o.now=o.now||o.mozNow||o.msNow||o.oNow||o.webkitNow,!n.performance||!n.performance.now){var r=Date.now();n.performance.now=function(){return Date.now()-r}}for(var i=Date.now(),a=["ms","moz","webkit","o"],c=a.length,u=0;u<c&&!n.requestAnimationFrame;++u){var f=a[u];n.requestAnimationFrame=n[f+"RequestAnimationFrame"],n.cancelAnimationFrame=n[f+"CancelAnimationFrame"]||n[f+"CancelRequestAnimationFrame"]}n.requestAnimationFrame||(n.requestAnimationFrame=function(t){if("function"!=typeof t)throw new TypeError(t+"is not a function");var e=Date.now(),n=16+i-e;return n<0&&(n=0),i=e,setTimeout(function(){i=Date.now(),t(o.now())},n)}),n.cancelAnimationFrame||(n.cancelAnimationFrame=function(t){return clearTimeout(t)});var l=n.cancelAnimationFrame,p=n.requestAnimationFrame;Object.defineProperty(t,"__esModule",{value:!0}),t.global=n,t.performance=o,t.cancelAnimationFrame=l,t.requestAnimationFrame=p,Object.defineProperty(t,"__esModule",{value:!0})});