storybook-prebuilt
Version:
A prebuilt storybook version for web components
3 lines (2 loc) • 3.39 kB
JavaScript
import{a as e,c as t,u as n}from"./storybook-prebuilt-3ba63d3f.js";import"./storybook-prebuilt-0b3b0ce5.js";import{d as r}from"./storybook-prebuilt-d40d7550.js";var i=function(e,t){if(o("noDeprecation"))return e;var n=!1;return function(){if(!n){if(o("throwDeprecation"))throw new Error(t);o("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function o(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}var s=t((function(e,t){function n(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Channel=void 0;var o=function(){return Math.random().toString(16).slice(2)},s=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.transport,s=n.async,a=void 0!==s&&s;r(this,e),this.isAsync=void 0,this.sender=o(),this.events={},this.transport=void 0,this.isAsync=a,i&&(this.transport=i,this.transport.setHandler((function(e){return t.handleEvent(e)})))}var t,s,a;return t=e,(s=[{key:"addListener",value:function(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)}},{key:"addPeerListener",value:function(e,t){var n=t;n.ignorePeer=!0,this.addListener(e,n)}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o={type:e,args:r,from:this.sender},s={};r.length>=1&&r[0]&&r[0].options&&(s=r[0].options);var a=function(){t.transport&&t.transport.send(o,s),t.handleEvent(o,!0)};this.isAsync?setImmediate(a):a()}},{key:"eventNames",value:function(){return Object.keys(this.events)}},{key:"listenerCount",value:function(e){var t=this.listeners(e);return t?t.length:0}},{key:"listeners",value:function(e){var t=this.events[e];return t||void 0}},{key:"once",value:function(e,t){var n=this.onceListener(e,t);this.addListener(e,n)}},{key:"removeAllListeners",value:function(e){e?this.events[e]&&delete this.events[e]:this.events={}}},{key:"removeListener",value:function(e,t){var n=this.listeners(e);n&&(this.events[e]=n.filter((function(e){return e!==t})))}},{key:"on",value:function(e,t){this.addListener(e,t)}},{key:"off",value:function(e,t){this.removeListener(e,t)}},{key:"handleEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.listeners(e.type);r&&(t||e.from!==this.sender)&&r.forEach((function(r){return!(t&&r.ignorePeer)&&r.apply(void 0,n(e.args))}))}},{key:"onceListener",value:function(e,t){var n=this,r=function r(){return n.removeListener(e,r),t.apply(void 0,arguments)};return r}},{key:"hasTransport",get:function(){return!!this.transport}}])&&i(t.prototype,s),a&&i(t,a),e}();t.Channel=s;var a=s;t.default=a}));n(s);s.Channel;export{r as _,s as a,i as r};
//# sourceMappingURL=storybook-prebuilt-e17bc3b1.js.map