diff --git a/index.html b/index.html index 984b921..ba1f989 100644 --- a/index.html +++ b/index.html @@ -8,8 +8,24 @@ - -
+ + + + + + diff --git a/src/components/app-base.js b/src/components/app-base.js index 3acc503..00ac09b 100644 --- a/src/components/app-base.js +++ b/src/components/app-base.js @@ -2,8 +2,6 @@ import Store from '../modules/store.js'; import text from '../modules/text.js'; class AppBase extends HTMLElement { - static observedAttributes = ['title', 'description']; - constructor() { super(); this.attachShadow({ mode: 'open' }); @@ -14,25 +12,18 @@ class AppBase extends HTMLElement { connectedCallback() { this.store.subscribe(this.render.bind(this)); this.render(); - - console.log('Component constructed', this); - } - - disconnectedCallback() { - console.log('Component disconnected', this); - } - - attributeChangedCallback() { - this.render(); } renderText() { const textList = this.store.getRecords(); - const selected = this.store.getSelected(); - return textList.map((item) => ``).join('\n'); + return textList.map((item) => ``).join('\n'); } - render() { + render(action = 'INITIAL') { + if (![Store.actions.ADD_LINE, Store.actions.REMOVE_LINE, Store.actions.UNDO, 'INITIAL'].includes(action)) { + return; // Only render if content changed + } + this.shadowRoot.innerHTML = `