a start with polyfill
This commit is contained in:
parent
72ad465134
commit
9c8f9283b3
2
dist/mailgo.dark.min.js
vendored
2
dist/mailgo.dark.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mailgo.dark.min.js.map
vendored
2
dist/mailgo.dark.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mailgo.min.js.map
vendored
2
dist/mailgo.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,6 @@
|
|||||||
// webpack > dist/mailgo.min.js
|
// webpack > dist/mailgo.min.js
|
||||||
|
|
||||||
|
import mailgoPolyfill from "./polyfill";
|
||||||
import mailgo from "../src/mailgo";
|
import mailgo from "../src/mailgo";
|
||||||
|
|
||||||
// call init mailgo attached to the event DOMContentLoaded
|
// call init mailgo attached to the event DOMContentLoaded
|
||||||
@ -8,4 +9,6 @@ const mailgoConfig = {
|
|||||||
dark: true,
|
dark: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mailgoPolyfill();
|
||||||
|
|
||||||
mailgo(mailgoConfig);
|
mailgo(mailgoConfig);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// webpack > dist/mailgo.min.js
|
// webpack > dist/mailgo.min.js
|
||||||
|
|
||||||
|
import mailgoPolyfill from "./polyfill";
|
||||||
import mailgo from "../src/mailgo";
|
import mailgo from "../src/mailgo";
|
||||||
|
|
||||||
// call init mailgo attached to the event DOMContentLoaded
|
// call init mailgo attached to the event DOMContentLoaded
|
||||||
@ -7,4 +8,6 @@ const mailgoConfig = {
|
|||||||
initEvent: "DOMContentLoaded",
|
initEvent: "DOMContentLoaded",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mailgoPolyfill();
|
||||||
|
|
||||||
mailgo(mailgoConfig);
|
mailgo(mailgoConfig);
|
||||||
|
43
webpack/polyfill.js
Normal file
43
webpack/polyfill.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// polyfill for mailgo
|
||||||
|
|
||||||
|
export default mailgoPolyfill = () => {
|
||||||
|
if (!Array.prototype.includes) {
|
||||||
|
Array.prototype.includes = function (searchElement /*, fromIndex*/) {
|
||||||
|
"use strict";
|
||||||
|
if (this == null) {
|
||||||
|
throw new TypeError(
|
||||||
|
"Array.prototype.includes called on null or undefined"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var O = Object(this);
|
||||||
|
var len = parseInt(O.length, 10) || 0;
|
||||||
|
if (len === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var n = parseInt(arguments[1], 10) || 0;
|
||||||
|
var k;
|
||||||
|
if (n >= 0) {
|
||||||
|
k = n;
|
||||||
|
} else {
|
||||||
|
k = len + n;
|
||||||
|
if (k < 0) {
|
||||||
|
k = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var currentElement;
|
||||||
|
while (k < len) {
|
||||||
|
currentElement = O[k];
|
||||||
|
if (
|
||||||
|
searchElement === currentElement ||
|
||||||
|
(searchElement !== searchElement && currentElement !== currentElement)
|
||||||
|
) {
|
||||||
|
// NaN !== NaN
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user