WebWorkerMainTemplate.runtime.js 2.1 KB

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