finished pruning for lit-only demo
This commit is contained in:
parent
648412dd6d
commit
3736d7278b
10 changed files with 217 additions and 281 deletions
|
|
@ -1,23 +0,0 @@
|
|||
export class StoreController {
|
||||
constructor(host, store, selector) {
|
||||
this.host = host
|
||||
this.store = store
|
||||
this.selector = selector
|
||||
host.addController(this)
|
||||
}
|
||||
|
||||
hostConnected() {
|
||||
this._unsub = this.store.subscribe(
|
||||
(state) => {
|
||||
const next = this.selector(state)
|
||||
if (next !== this.value) {
|
||||
this.value = next
|
||||
this.host.requestUpdate()
|
||||
}
|
||||
}
|
||||
)
|
||||
this.value = this.selector(this.store.getState())
|
||||
}
|
||||
|
||||
hostDisconnected() { this._unsub?.() }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue