diff --git a/Logic/UIEventSource.ts b/Logic/UIEventSource.ts index f7ffbb916..b161f262b 100644 --- a/Logic/UIEventSource.ts +++ b/Logic/UIEventSource.ts @@ -1,5 +1,5 @@ import { Utils } from "../Utils" -import { Readable, Subscriber, Unsubscriber } from "svelte/store" +import { Readable, Subscriber, Unsubscriber, Updater, Writable } from "svelte/store" /** * Various static utils @@ -542,7 +542,7 @@ class MappedStore extends Store { } } -export class UIEventSource extends Store { +export class UIEventSource extends Store implements Writable { public data: T _callbacks: ListenerTracker = new ListenerTracker() @@ -786,4 +786,12 @@ export class UIEventSource extends Store { (b) => "" + b ) } + + set(value: T): void { + this.setData(value) + } + + update(f: Updater & ((value: T) => T)): void { + this.setData(f(this.data)) + } }