From 3bc876bbf417459a2395b01b146fc3ed0e732212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kerekes?= Date: Mon, 23 Mar 2020 15:25:25 +0100 Subject: [PATCH 1/4] Removed polyfills --- package-lock.json | 5 ----- package.json | 1 - src/Vueresize.js | 2 -- src/findPolyfill.js | 45 --------------------------------------------- 4 files changed, 53 deletions(-) delete mode 100644 src/findPolyfill.js diff --git a/package-lock.json b/package-lock.json index de047b8..430ed10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2810,11 +2810,6 @@ "integrity": "sha1-1Xn7f2k7hYAElHrzn6DbSfeVYCw=", "dev": true }, - "intersection-observer": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/intersection-observer/-/intersection-observer-0.5.0.tgz", - "integrity": "sha512-8Zgt4ijlyvIrQVTA7MPb2W9+KhoetrAbxlh0RmTGxpx0+ZsAXvy7IsbNnZIrqZ6TddAdWeQj49x7Ph7Ir6KRkA==" - }, "invariant": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", diff --git a/package.json b/package.json index f7d9968..ab9de2a 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ }, "dependencies": { "css-element-queries": "^1.0.2", - "intersection-observer": "^0.5.0", "lodash.debounce": "^4.0.8" }, "devDependencies": { diff --git a/src/Vueresize.js b/src/Vueresize.js index af83bdf..09145c0 100644 --- a/src/Vueresize.js +++ b/src/Vueresize.js @@ -1,7 +1,5 @@ import ResizeSensor from 'resizeSensor' import lodashDebounce from 'lodash.debounce' -require('./findPolyfill'); -require('intersection-observer'); const { debounce = lodashDebounce } = lodashDebounce; const defaultDelay = 150; diff --git a/src/findPolyfill.js b/src/findPolyfill.js deleted file mode 100644 index dc8f7f2..0000000 --- a/src/findPolyfill.js +++ /dev/null @@ -1,45 +0,0 @@ -if (!Array.prototype.find) { - Object.defineProperty(Array.prototype, 'find', { - value: function(predicate) { - // 1. Let O be ? ToObject(this value). - if (this == null) { - throw new TypeError('"this" is null or not defined'); - } - - var o = Object(this); - - // 2. Let len be ? ToLength(? Get(O, "length")). - var len = o.length >>> 0; - - // 3. If IsCallable(predicate) is false, throw a TypeError exception. - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); - } - - // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. - var thisArg = arguments[1]; - - // 5. Let k be 0. - var k = 0; - - // 6. Repeat, while k < len - while (k < len) { - // a. Let Pk be ! ToString(k). - // b. Let kValue be ? Get(O, Pk). - // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). - // d. If testResult is true, return kValue. - var kValue = o[k]; - if (predicate.call(thisArg, kValue, k, o)) { - return kValue; - } - // e. Increase k by 1. - k++; - } - - // 7. Return undefined. - return undefined; - }, - configurable: true, - writable: true - }); -} \ No newline at end of file From 101b3ce7ac207956e03b7b9d08f311973ee11036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kerekes?= Date: Mon, 23 Mar 2020 18:41:54 +0100 Subject: [PATCH 2/4] Updated readme to mention the required polyfills --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a53f31..308ca33 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ export default { resize, } //... - + // ES5 var resize = require('vue-resize-directive') ``` @@ -85,3 +85,12 @@ var resize = require('vue-resize-directive') - #### For `