diff --git a/src/js/core/polyfills.js b/src/js/core/polyfills.js deleted file mode 100644 index 5f979c43..00000000 --- a/src/js/core/polyfills.js +++ /dev/null @@ -1,38 +0,0 @@ -function mathPolyfills() { - // Converts from degrees to radians. - Math.radians = function (degrees) { - return (degrees * Math.PI) / 180.0; - }; - - // Converts from radians to degrees. - Math.degrees = function (radians) { - return (radians * 180.0) / Math.PI; - }; -} - -function domPolyfills() { - // from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md - (function (arr) { - arr.forEach(function (item) { - if (item.hasOwnProperty("remove")) { - return; - } - Object.defineProperty(item, "remove", { - configurable: true, - enumerable: true, - writable: true, - value: function remove() { - this.parentNode.removeChild(this); - }, - }); - }); - })([Element.prototype, CharacterData.prototype, DocumentType.prototype]); -} - -function initPolyfills() { - mathPolyfills(); - domPolyfills(); -} - -// Other polyfills -initPolyfills(); diff --git a/src/js/core/polyfills.ts b/src/js/core/polyfills.ts new file mode 100644 index 00000000..0467e50f --- /dev/null +++ b/src/js/core/polyfills.ts @@ -0,0 +1,9 @@ +// Converts from degrees to radians. +Math.radians = function (degrees: number): number { + return (degrees * Math.PI) / 180.0; +}; + +// Converts from radians to degrees. +Math.degrees = function (radians: number): number { + return (radians * 180.0) / Math.PI; +};