Files
swagger-ui/src/core/window.js
Tim Lai 2eaa6c10e4 feat(build): es2015 bundle artifact (#6291)
* 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
2020-08-13 17:21:55 -07:00

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()