Wramp
this is a core package of Wramp and this doesn't depdend on any view frameworks.
API
defineStore(StateClass): StoreClass
This generates a store class which wraps a given class. Actually, it just extends the given class dynamically.
Therefore the store class behaves exactly like the wrapped class.
Additionally, you can observe some method calls by passing a store instance to watch
.
watch(store, subWatchers = []): StoreWatcher
This takes an instance of a store class generated by defineStore
and returns StoreWatcher
that observes the given store instance.
If subWatchers
are specified, StoreWatcher
observes events published by these watchers too.
StoreWatcher
#onUpdate(handler: (updateData, store) => void): void
This takes a handler function which is called whenever an update method of store is called.
If StoreWatcher
obseerves other watchers, the handler is called too when they publish an update event.
If an update method calls another update method inside of it, StoreWatcher
publishes it as one update event.