import makeEmitter, { Emitter } from 'better-emitter'
export interface BasicObservable<T> extends Emitter {
get(): T,
set(newValue: T): void,
locked(): boolean
}
export interface WargObservable<T> extends BasicObservable<T> {
subscribe(cb: (T) => void): () => void,
map<R>(fn: (T) => R): WargObservable<R>
}
type DependencyObject<T extends { [key: string]: any }> = {
[key in keyof T]: BasicObservable<T[key]>
}
export const value = <T>(value: T): WargObservable<T> => {
const emitter = makeEmitter({
get() {
This file has been truncated. show original