animation-frame-polyfill 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,17 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.requestAnimationFrame = exports.cancelAnimationFrame = void 0;
|
|
7
7
|
var prefix = ['webkit', 'moz', 'ms', 'o'];
|
|
8
|
-
|
|
9
|
-
var requestAnimationFrame = function () {
|
|
8
|
+
var requestAnimationFrame = exports.requestAnimationFrame = function () {
|
|
10
9
|
for (var i = 0, limit = prefix.length; i < limit && !window.requestAnimationFrame; ++i) {
|
|
11
10
|
window.requestAnimationFrame = window[prefix[i] + 'RequestAnimationFrame'];
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
if (!window.requestAnimationFrame) {
|
|
15
13
|
var lastTime = 0;
|
|
16
|
-
|
|
17
14
|
window.requestAnimationFrame = function (callback) {
|
|
18
15
|
var now = new Date().getTime();
|
|
19
16
|
var ttc = Math.max(0, 16 - now - lastTime);
|
|
@@ -24,24 +21,16 @@ var requestAnimationFrame = function () {
|
|
|
24
21
|
return timer;
|
|
25
22
|
};
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
return window.requestAnimationFrame.bind(window);
|
|
29
25
|
}();
|
|
30
|
-
|
|
31
|
-
exports.requestAnimationFrame = requestAnimationFrame;
|
|
32
|
-
|
|
33
|
-
var cancelAnimationFrame = function () {
|
|
26
|
+
var cancelAnimationFrame = exports.cancelAnimationFrame = function () {
|
|
34
27
|
for (var i = 0, limit = prefix.length; i < limit && !window.cancelAnimationFrame; ++i) {
|
|
35
28
|
window.cancelAnimationFrame = window[prefix[i] + 'CancelAnimationFrame'] || window[prefix[i] + 'CancelRequestAnimationFrame'];
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
if (!window.cancelAnimationFrame) {
|
|
39
31
|
window.cancelAnimationFrame = function (timer) {
|
|
40
32
|
window.clearTimeout(timer);
|
|
41
33
|
};
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
return window.cancelAnimationFrame.bind(window);
|
|
45
36
|
}();
|
|
46
|
-
|
|
47
|
-
exports.cancelAnimationFrame = cancelAnimationFrame;
|
|
@@ -3,10 +3,8 @@ export var requestAnimationFrame = function () {
|
|
|
3
3
|
for (var i = 0, limit = prefix.length; i < limit && !window.requestAnimationFrame; ++i) {
|
|
4
4
|
window.requestAnimationFrame = window[prefix[i] + 'RequestAnimationFrame'];
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
if (!window.requestAnimationFrame) {
|
|
8
7
|
var lastTime = 0;
|
|
9
|
-
|
|
10
8
|
window.requestAnimationFrame = function (callback) {
|
|
11
9
|
var now = new Date().getTime();
|
|
12
10
|
var ttc = Math.max(0, 16 - now - lastTime);
|
|
@@ -17,19 +15,16 @@ export var requestAnimationFrame = function () {
|
|
|
17
15
|
return timer;
|
|
18
16
|
};
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
return window.requestAnimationFrame.bind(window);
|
|
22
19
|
}();
|
|
23
20
|
export var cancelAnimationFrame = function () {
|
|
24
21
|
for (var i = 0, limit = prefix.length; i < limit && !window.cancelAnimationFrame; ++i) {
|
|
25
22
|
window.cancelAnimationFrame = window[prefix[i] + 'CancelAnimationFrame'] || window[prefix[i] + 'CancelRequestAnimationFrame'];
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
if (!window.cancelAnimationFrame) {
|
|
29
25
|
window.cancelAnimationFrame = function (timer) {
|
|
30
26
|
window.clearTimeout(timer);
|
|
31
27
|
};
|
|
32
28
|
}
|
|
33
|
-
|
|
34
29
|
return window.cancelAnimationFrame.bind(window);
|
|
35
30
|
}();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "animation-frame-polyfill",
|
|
3
3
|
"title": "Animation Frame Polyfill",
|
|
4
4
|
"description": "Polyfill requestAnimationFrame and cancelAnimationFrame",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.3",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "eric@webdeveric.com",
|
|
@@ -38,24 +38,24 @@
|
|
|
38
38
|
"lib/",
|
|
39
39
|
"src/"
|
|
40
40
|
],
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@babel/cli": "^7.28.3",
|
|
43
|
+
"@babel/core": "^7.28.5",
|
|
44
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
45
|
+
"@babel/preset-env": "^7.28.5",
|
|
46
|
+
"@webdeveric/eslint-config-babel": "^0.4.3",
|
|
47
|
+
"core-js": "^3.47.0",
|
|
48
|
+
"cspell": "^9.4.0",
|
|
49
|
+
"eslint": "^8.57.1",
|
|
50
|
+
"rimraf": "^6.1.2"
|
|
51
|
+
},
|
|
41
52
|
"scripts": {
|
|
42
53
|
"clean": "rimraf ./lib",
|
|
43
54
|
"lint": "eslint --fix src",
|
|
44
55
|
"build:cjs": "babel src -o lib/animation-frame-polyfill.cjs.js --no-babelrc --presets=@babel/preset-env",
|
|
45
56
|
"build:module": "babel src -o lib/animation-frame-polyfill.module.js",
|
|
46
|
-
"prebuild": "
|
|
47
|
-
"build": "
|
|
48
|
-
"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@babel/cli": "^7.12.1",
|
|
53
|
-
"@babel/core": "^7.12.3",
|
|
54
|
-
"@babel/eslint-parser": "^7.12.1",
|
|
55
|
-
"@babel/preset-env": "^7.12.1",
|
|
56
|
-
"core-js": "^3.7.0",
|
|
57
|
-
"eslint": "^7.13.0",
|
|
58
|
-
"eslint-config-webdeveric": "^0.7.0",
|
|
59
|
-
"rimraf": "^3.0.2"
|
|
57
|
+
"prebuild": "pnpm clean",
|
|
58
|
+
"build": "pnpm build:cjs && pnpm build:module",
|
|
59
|
+
"spellcheck": "cspell --no-progress './**/*'"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|