Advertisement
Guest User

Untitled

a guest
Jul 13th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. // Store dynamic bundle exports.
  3. var cache = {}
  4. // Store dynamic bundle loading callbacks, in case the same module is imported
  5. // multiple times simultaneously.
  6. var receivers = {}
  7.  
  8. // Attach a promise to a callback, that is settled when the callback is called.
  9. function promisify (cb) {
  10.   var res
  11.   var rej
  12.   var p = typeof Promise !== 'undefined' && new Promise(function (resolve, reject) {
  13.     res = resolve
  14.     rej = reject
  15.   })
  16.   pcb.p = p
  17.   return pcb
  18.   function pcb (err, val) {
  19.     if (cb) cb(err, val)
  20.     if (err) rej(err)
  21.     else res(val)
  22.   }
  23. }
  24.  
  25. function load (index, cb) {
  26.   cb = promisify(cb)
  27.   // We already have this bundle.
  28.   if (cache[index]) {
  29.     setTimeout(cb.bind(null, null, cache[index]), 0)
  30.     return cb.p
  31.   }
  32.  
  33.   var url = load.b[index]
  34.   // TODO throw an error if we don't have the url
  35.  
  36.   // Combine callbacks if another one was already registered.
  37.   var prev = receivers[index]
  38.   receivers[index] = onload
  39.  
  40.   function onload (err, result) {
  41.     if (prev) prev(err, result)
  42.     else if (!err) cache[index] = result
  43.     if (cb) cb(err, result)
  44.     delete receivers[index]
  45.   }
  46.  
  47.   // The <script> element for this bundle was already added.
  48.   if (prev) return cb.p
  49.  
  50.   var integrity = load.s[index]
  51.   var crossOrigin = load.c
  52.  
  53.   var s = document.createElement('script')
  54.   s.async = true
  55.   if (crossOrigin) s.crossOrigin = crossOrigin
  56.   if (integrity) s.integrity = integrity
  57.  
  58.   s.type = 'application/javascript'
  59.   s.src = url
  60.   s.onerror = function () {
  61.     onload(Error('Failed to load'))
  62.   }
  63.   document.body.appendChild(s)
  64.   return cb.p
  65. }
  66.  
  67. // Called by dynamic bundles once they have loaded.
  68. function loadedBundle (index, result) {
  69.   if (receivers[index]) {
  70.     receivers[index](null, result)
  71.   } else {
  72.     cache[index] = result
  73.   }
  74. }
  75.  
  76. // "Load" a module that we know is included in this bundle.
  77. var nextTick = window.setImmediate || window.setTimeout
  78. function loadLocal (requirer, onload) {
  79.   onload = promisify(onload)
  80.   nextTick(function () {
  81.     // Just execute the module if no callback is provided
  82.     if (!onload) return requirer()
  83.     try {
  84.       onload(null, requirer())
  85.     } catch (err) {
  86.       onload(err)
  87.     }
  88.   })
  89.   return onload.p
  90. }
  91.  
  92. // Map dynamic bundle entry point IDs to URLs.
  93. load.b = {}
  94. // Subresource integrity hashes
  95. load.s = {}
  96. // Cross-origin loading
  97. load.c = null
  98.  
  99. // Used by the bundle.
  100. load.l = loadedBundle
  101. load.t = loadLocal
  102.  
  103. module.exports = load
  104.  
  105. },{}],2:[function(require,module,exports){
  106. 'use strict';
  107.  
  108. var splitRequire = require('split-require');
  109.  
  110. document.addEventListener('DOMContentLoaded', function () {
  111.   splitRequire('./test', function () {
  112.     console.log(arguments);
  113.   });
  114. });
  115.  
  116. },{"split-require":1}]},{},[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement