@stories-js/core
Version:
Stories web components to build stories
55 lines (48 loc) • 1.57 kB
JavaScript
/*!
* (C) StoriesJS https://storiesjs.org - GPL-2.0 License
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./index-c25eada5.js');
const index$1 = require('./index-92599979.js');
const messages = require('./messages-666e577a.js');
require('./index-ad63dbd0.js');
const CONTROL_EVENT = 'CONTROL_EVENT';
const addonControlsCss = ":host{display:block}";
const AddonControls = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.controls = [];
this.onControl = (event) => {
// this.store.state.actions.push(actionDisplay)
console.log('onControl.event', event);
};
}
title() {
return "Controls";
}
async storyContextChanged(story, context) {
console.log('AddonControls.storyContextChanged', story, context);
}
async componentDidLoad() {
// Register addon
index$1.api.registerAddon(this);
// Register event listeners
messages.messages.on(CONTROL_EVENT, this.onControl);
// Create store
// this.store = createStore({controls: []})
}
async disconnectedCallback() {
// Unregister event listener
messages.messages.off(CONTROL_EVENT, this.onControl);
// Unregster addon
index$1.api.unregisterAddon(this);
}
render() {
return (index.h(index.Host, null, index.h("div", null, "Addon Controls")));
}
get el() { return index.getElement(this); }
};
AddonControls.style = addonControlsCss;
exports.stories_addon_controls = AddonControls;
//# sourceMappingURL=stories-addon-controls.cjs.entry.js.map