StoreFacade
is a mechanism to easily store and manage data in the app. StoreFacade
keeps data in a global field.
Its public methods:
set(key as String, value as Dynamic)
- stores a value under given keyget(key as String)
- returns a stored value from given key;Invalid
if doesn't existhasKey(key as String)
- checks if given key is storedconsume(key as String)
- return a stored value from given key and removes it from the storeremove(key as String)
- removes value and key from the storesetFields(newSet as Object)
- similar toset()
, but allows setting multiple values at oncesubscribe(key as String, callback as Function, context = Invalid as Object)
- subscribes to value changes from a given key and calls the callback function on every change, optionally the context could be providedunsubscribe(key as String, callback as Function)
- unsubscribes specific callback of the keysubscribeOnce(key as String, callback as Function, context = Invalid as Object)
- similar tosubscribe
but it automatically unsubscribes after the first callback runupdateNode(key as String, value as Dynamic)
- updates fields (passed asvalue
object) of the stored node from given keyupdateAA(key as String, updatedData as Object)
- updates fields of the stored AA from given key