-
Notifications
You must be signed in to change notification settings - Fork 5
/
JsonpMainTemplate.runtime.js
62 lines (58 loc) · 2.33 KB
/
JsonpMainTemplate.runtime.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ */
// TODO, hot reload 这些需要专门针对 mp 进行实现,待定
module.exports = function() {
function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
hotAddUpdateChunk(chunkId, moreModules);
if(global.parentHotUpdateCallback) global.parentHotUpdateCallback(chunkId, moreModules);
} //$semicolon
function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
// var head = document.getElementsByTagName("head")[0];
// var script = document.createElement("script");
// script.type = "text/javascript";
// script.charset = "utf-8";
// script.src = $require$.p + $hotChunkFilename$;
// head.appendChild(script);
}
function hotDownloadManifest(requestTimeout) { // eslint-disable-line no-unused-vars
// requestTimeout = requestTimeout || 10000;
// return new Promise(function(resolve, reject) {
// if(typeof XMLHttpRequest === "undefined")
// return reject(new Error("No browser support"));
// try {
// var request = new XMLHttpRequest();
// var requestPath = $require$.p + $hotMainFilename$;
// request.open("GET", requestPath, true);
// request.timeout = requestTimeout;
// request.send(null);
// } catch(err) {
// return reject(err);
// }
// request.onreadystatechange = function() {
// if(request.readyState !== 4) return;
// if(request.status === 0) {
// // timeout
// reject(new Error("Manifest request to " + requestPath + " timed out."));
// } else if(request.status === 404) {
// // no update available
// resolve();
// } else if(request.status !== 200 && request.status !== 304) {
// // other failure
// reject(new Error("Manifest request to " + requestPath + " failed."));
// } else {
// // success
// try {
// var update = JSON.parse(request.responseText);
// } catch(e) {
// reject(e);
// return;
// }
// resolve(update);
// }
// };
// });
}
};