You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WebWorkerMainTemplate.runtime.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. /*globals installedChunks hotAddUpdateChunk parentHotUpdateCallback importScripts XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ */
  6. module.exports = function() {
  7. // eslint-disable-next-line no-unused-vars
  8. function webpackHotUpdateCallback(chunkId, moreModules) {
  9. hotAddUpdateChunk(chunkId, moreModules);
  10. if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
  11. } //$semicolon
  12. // eslint-disable-next-line no-unused-vars
  13. function hotDownloadUpdateChunk(chunkId) {
  14. importScripts($require$.p + $hotChunkFilename$);
  15. }
  16. // eslint-disable-next-line no-unused-vars
  17. function hotDownloadManifest(requestTimeout) {
  18. requestTimeout = requestTimeout || 10000;
  19. return new Promise(function(resolve, reject) {
  20. if (typeof XMLHttpRequest === "undefined") {
  21. return reject(new Error("No browser support"));
  22. }
  23. try {
  24. var request = new XMLHttpRequest();
  25. var requestPath = $require$.p + $hotMainFilename$;
  26. request.open("GET", requestPath, true);
  27. request.timeout = requestTimeout;
  28. request.send(null);
  29. } catch (err) {
  30. return reject(err);
  31. }
  32. request.onreadystatechange = function() {
  33. if (request.readyState !== 4) return;
  34. if (request.status === 0) {
  35. // timeout
  36. reject(
  37. new Error("Manifest request to " + requestPath + " timed out.")
  38. );
  39. } else if (request.status === 404) {
  40. // no update available
  41. resolve();
  42. } else if (request.status !== 200 && request.status !== 304) {
  43. // other failure
  44. reject(new Error("Manifest request to " + requestPath + " failed."));
  45. } else {
  46. // success
  47. try {
  48. var update = JSON.parse(request.responseText);
  49. } catch (e) {
  50. reject(e);
  51. return;
  52. }
  53. resolve(update);
  54. }
  55. };
  56. });
  57. }
  58. //eslint-disable-next-line no-unused-vars
  59. function hotDisposeChunk(chunkId) {
  60. delete installedChunks[chunkId];
  61. }
  62. };