@liascript/exporter
Version:
A generic exporter for LiaScript
1 lines • 3.89 kB
JavaScript
!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof i[r]&&i[r],c=s.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!c[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(s)return s(t,!0);if(u&&"string"==typeof t)return u(t);var l=new Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var f=c[t]=new a.Module(t);e[t][0].call(f.exports,d,f,f.exports,this)}return c[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=c,a.parent=s,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return i[r]}}),i[r]=a;for(var l=0;l<t.length;l++)a(t[l])}({fdYUJ:[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"Sync",(()=>s));var o=e("../Base/index"),i=e("uint8-to-base64");class s extends o.Sync{subject="liasync";connected=!1;async connect(e){super.connect(e),this.init(!0)}destroy(){this.listener&&window.removeEventListener("message",this.listener),super.destroy()}init(e,t){if(e){this.subject=this.room||"liasync";let e=this;this.listener=function(t){try{let n=t.data;switch(n.subject){case"init":n.body&&(e.connected=!0,e.sendConnect());break;case"publish":n.body&&e.pubsubReceive(n.body);break;default:n.body&&e.applyUpdate((0,i.decode)(n.body))}}catch(e){console.warn("Edrys",e.message)}},window.addEventListener("message",this.listener),this.broadcast(!0,null,"init"),setTimeout((function(){e.connected||e.sendDisconnectError("This seems not to be an Edrys classroom")}),2e3)}}broadcast(e,t,n){let r=e?n||this.subject:"publish";window.parent.postMessage({subject:r,body:t?(0,i.encode)(t):null},"*")}}},{"../Base/index":"2cTju","uint8-to-base64":"cdRXY","@parcel/transformer-js/src/esmodule-helpers.js":"XTfsy"}],fDdlt:[function(e,t,n){var r,o,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{o="function"==typeof clearTimeout?clearTimeout:c}catch(e){o=c}}();var a,l=[],f=!1,d=-1;function h(){f&&a&&(f=!1,a.length?l=a.concat(l):d=-1,l.length&&p())}function p(){if(!f){var e=u(h);f=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,f=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===c||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{return o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function y(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new y(e,t)),1!==l.length||f||u(p)},y.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}]},[],0,"parcelRequire55a5");