* es2015 bundle with dependencies via npm script build:es:bundle * es2015 bundle without dependencies via npm script build:es:bundle * jest dependency for test:artifact * migrate babel.config.json to babel.config.js and maintain env support for commonjs and es2015 * remove polyfill * fix es syntax: replace module.exports with export * fix es syntax: remove .jsx extension inside import
30 lines
463 B
JavaScript
30 lines
463 B
JavaScript
function makeWindow() {
|
|
var win = {
|
|
location: {},
|
|
history: {},
|
|
open: () => {},
|
|
close: () => {},
|
|
File: function() {}
|
|
}
|
|
|
|
if(typeof window === "undefined") {
|
|
return win
|
|
}
|
|
|
|
try {
|
|
win = window
|
|
var props = ["File", "Blob", "FormData"]
|
|
for (var prop of props) {
|
|
if (prop in window) {
|
|
win[prop] = window[prop]
|
|
}
|
|
}
|
|
} catch( e ) {
|
|
console.error(e)
|
|
}
|
|
|
|
return win
|
|
}
|
|
|
|
export default makeWindow()
|