A value to which observers can subscribe to, which will then be notified whenever the value changes. If relevant, the following pattern can be used to only expose the subscribe function:
subscribe
class Foo { #notifier: ValueNotifier<number> = new ValueNotifier(0) get notifier(): ObservableValue<number> { return this.#notifier }} Copy
class Foo { #notifier: ValueNotifier<number> = new ValueNotifier(0) get notifier(): ObservableValue<number> { return this.#notifier }}
or
class Test { readonly #notifier: ValueNotifier<number> = new ValueNotifier(0) readonly observer = this.#notifier as ObservableValue<number>} Copy
class Test { readonly #notifier: ValueNotifier<number> = new ValueNotifier(0) readonly observer = this.#notifier as ObservableValue<number>}
A value to which observers can subscribe to, which will then be notified whenever the value changes. If relevant, the following pattern can be used to only expose the
subscribefunction:or