1a47f81.js.map 3.1 KB

1
  1. {"version":3,"sources":["webpack:///./components/Tinymce/dynamicLoadScript.js"],"names":["callbacks","dynamicLoadScript","src","callback","existingScript","document","getElementById","cb","script","createElement","id","body","appendChild","push","onEnd","onload","this","onerror","_step","_iterator","_createForOfIteratorHelper","s","n","done","value","err","e","f","Error","onreadystatechange","readyState","_step2","_iterator2","window","tinymce"],"mappings":"ypCAAA,IAAIA,EAAY,GA0DDC,UAlDW,SAACC,EAAKC,GAC9B,IAAMC,EAAiBC,SAASC,eAAeJ,GACzCK,EAAKJ,GAAY,WAAY,EAEnC,IAAKC,EAAgB,CACnB,IAAMI,OAASH,SAASI,cAAc,UACtCD,OAAON,IAAMA,EACbM,OAAOE,GAAKR,EACZG,SAASM,KAAKC,YAAYJ,QAC1BR,EAAUa,KAAKN,GACf,IAAMO,EAAQ,WAAYN,OAY5B,SAAkBA,QAChBA,OAAOO,OAAS,WAGdC,KAAKC,QAAUD,KAAKD,OAAS,KAAI,IACPG,EADOC,EAAAC,EAChBpB,GAAS,IAA1B,IAAAmB,EAAAE,MAAAH,EAAAC,EAAAG,KAAAC,MAA4B,EAC1BhB,EADWW,EAAAM,OACR,KAAMhB,OACX,CAAC,OAAAiB,GAAAN,EAAAO,EAAAD,EAAA,SAAAN,EAAAQ,GAAA,CACD3B,EAAY,IACd,EACAQ,OAAOS,QAAU,WACfD,KAAKC,QAAUD,KAAKD,OAAS,KAC7BR,EAAG,IAAIqB,MAAM,kBAAoB1B,GAAMM,OACzC,CACF,EAEA,SAAiBA,QACfA,OAAOqB,mBAAqB,WAC1B,GAAwB,aAApBb,KAAKc,YAAiD,WAApBd,KAAKc,WAA3C,CACAd,KAAKa,mBAAqB,KAAI,IACJE,EADIC,EAAAZ,EACbpB,GAAS,IAA1B,IAAAgC,EAAAX,MAAAU,EAAAC,EAAAV,KAAAC,MAA4B,EAC1BhB,EADWwB,EAAAP,OACR,KAAMhB,OACX,CAAC,OAAAiB,GAAAO,EAAAN,EAAAD,EAAA,SAAAO,EAAAL,GAAA,CACD3B,EAAY,IAL8D,CAM5E,CACF,EApCEc,EAAMN,OACR,CAEIJ,GAAkBG,IAjBf0B,OAAOC,QAmBV3B,EAAG,KAAMH,GAETJ,EAAUa,KAAKN,GA8BrB,C","file":"1a47f81.js","sourcesContent":["let callbacks = []\n\nfunction loadedTinymce() {\n // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2144\n // check is successfully downloaded script\n return window.tinymce\n}\n\nconst dynamicLoadScript = (src, callback) => {\n const existingScript = document.getElementById(src)\n const cb = callback || function() {}\n\n if (!existingScript) {\n const script = document.createElement('script')\n script.src = src // src url for the third-party library being loaded.\n script.id = src\n document.body.appendChild(script)\n callbacks.push(cb)\n const onEnd = 'onload' in script ? stdOnEnd : ieOnEnd\n onEnd(script)\n }\n\n if (existingScript && cb) {\n if (loadedTinymce()) {\n cb(null, existingScript)\n } else {\n callbacks.push(cb)\n }\n }\n\n function stdOnEnd(script) {\n script.onload = function() {\n // this.onload = null here is necessary\n // because even IE9 works not like others\n this.onerror = this.onload = null\n for (const cb of callbacks) {\n cb(null, script)\n }\n callbacks = null\n }\n script.onerror = function() {\n this.onerror = this.onload = null\n cb(new Error('Failed to load ' + src), script)\n }\n }\n\n function ieOnEnd(script) {\n script.onreadystatechange = function() {\n if (this.readyState !== 'complete' && this.readyState !== 'loaded') return\n this.onreadystatechange = null\n for (const cb of callbacks) {\n cb(null, script) // there is no way to catch loading errors in IE8\n }\n callbacks = null\n }\n }\n}\n\nexport default dynamicLoadScript\n"],"sourceRoot":""}