1 | const Template = require('./Template');
|
2 | const XMLHttpRequestRuntime = Template.getFunctionContent(require('./polyfill/XMLHttpRequest'));
|
3 |
|
4 | module.exports = `
|
5 | var global;
|
6 |
|
7 | if (typeof window !== 'undefined') {
|
8 | global = window;
|
9 | } else if (typeof global !== 'undefined') {
|
10 | global = global;
|
11 | } else if (typeof self !== 'undefined') {
|
12 | global = self;
|
13 | } else {
|
14 | global = {};
|
15 | };
|
16 |
|
17 |
|
18 | // reload polyfill
|
19 | var isWeex = typeof callNative === 'function';
|
20 |
|
21 | if (isWeex && typeof location.reload === 'undefined') {
|
22 | var LOCATION_MODULE = '@weex-module/location';
|
23 |
|
24 | location.reload = function(forceReload) {
|
25 | var weexLocation = require(LOCATION_MODULE);
|
26 | weexLocation.reload(forceReload);
|
27 | };
|
28 | };
|
29 |
|
30 | if (typeof XMLHttpRequest === 'undefined') {
|
31 | ${XMLHttpRequestRuntime}
|
32 | }
|
33 | `;
|