Skip to content

Commit 9f0e406

Browse files
remove some polyfill
1 parent 43b02dc commit 9f0e406

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

src/core/shim.js

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +0,0 @@
1-
// requestAnim shim layer by Paul Irish
2-
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
3-
// http://my.opera.com/emoller/blog/2011/12/20/
4-
// requestanimationframe-for-smart-er-animating
5-
// requestAnimationFrame polyfill by Erik Möller
6-
// fixes from Paul Irish and Tino Zijdel
7-
window.requestAnimationFrame = (() =>
8-
window.requestAnimationFrame ||
9-
window.webkitRequestAnimationFrame ||
10-
window.mozRequestAnimationFrame ||
11-
window.oRequestAnimationFrame ||
12-
window.msRequestAnimationFrame ||
13-
((callback, element) => {
14-
// should '60' here be framerate?
15-
window.setTimeout(callback, 1000 / 60);
16-
}))();
17-
18-
/**
19-
* shim for Uint8ClampedArray.slice
20-
* (allows arrayCopy to work with pixels[])
21-
* with thanks to http://halfpapstudios.com/blog/tag/html5-canvas/
22-
* Enumerable set to false to protect for...in from
23-
* Uint8ClampedArray.prototype pollution.
24-
*/
25-
(() => {
26-
if (
27-
typeof Uint8ClampedArray !== 'undefined' &&
28-
!Uint8ClampedArray.prototype.slice
29-
) {
30-
Object.defineProperty(Uint8ClampedArray.prototype, 'slice', {
31-
value: Array.prototype.slice,
32-
writable: true,
33-
configurable: true,
34-
enumerable: false
35-
});
36-
}
37-
})();
38-
39-
/**
40-
* this is implementation of Object.assign() which is unavailable in
41-
* IE11 and (non-Chrome) Android browsers.
42-
* The assign() method is used to copy the values of all enumerable
43-
* own properties from one or more source objects to a target object.
44-
* It will return the target object.
45-
* Modified from https://github.com/ljharb/object.assign
46-
*/
47-
(() => {
48-
if (!Object.assign) {
49-
const keys = Object.keys;
50-
const defineProperty = Object.defineProperty;
51-
const canBeObject = obj => typeof obj !== 'undefined' && obj !== null;
52-
const hasSymbols =
53-
typeof Symbol === 'function' && typeof Symbol() === 'symbol';
54-
const propIsEnumerable = Object.prototype.propertyIsEnumerable;
55-
const isEnumerableOn = obj =>
56-
(function isEnumerable(prop) {
57-
return propIsEnumerable.call(obj, prop);
58-
});
59-
60-
// per ES6 spec, this function has to have a length of 2
61-
const assignShim = function assign(target, source1) {
62-
if (!canBeObject(target)) {
63-
throw new TypeError('target must be an object');
64-
}
65-
const objTarget = Object(target);
66-
let s, source, i, props;
67-
for (s = 1; s < arguments.length; ++s) {
68-
source = Object(arguments[s]);
69-
props = keys(source);
70-
if (hasSymbols && Object.getOwnPropertySymbols) {
71-
props.push(
72-
...Object.getOwnPropertySymbols(source)
73-
.filter(isEnumerableOn(source))
74-
);
75-
}
76-
for (i = 0; i < props.length; ++i) {
77-
objTarget[props[i]] = source[props[i]];
78-
}
79-
}
80-
return objTarget;
81-
};
82-
83-
defineProperty(Object, 'assign', {
84-
value: assignShim,
85-
configurable: true,
86-
enumerable: false,
87-
writable: true
88-
});
89-
}
90-
})();

0 commit comments

Comments
 (0)