Extras, but useful stuff
extras
Static Members
Several utility functions / libs used by alo
Some of this functions / libs might change over time: Please read the description of the specific function / lib.
Util()
Instance Members
Lodash cloneDeep, can be used
cloneDeep()
Lodash values, can be used
values()
Lodash forEach, can be used
forEach()
Lodash isFunction, can be used
isFunction()
Lodash isString, can be used
isString()
Lodash isObject, can be used
isObject()
Lodash isEqual, can be used
isEqual()
Lodash isPlainObject, can be used
isPlainObject()
Lodash isArray, can be used
isArray()
Lodash isBoolean, can be used
isBoolean()
Lodash uniqueId, can be used
uniqueId()
Flyd stream: Might change!
createStream()
Flyd stream: Might change!
combineStreams()
Flyd isStream: Might change!
isStream()
Flyd endsOn: Might change!
streamEndsOn()
Flyd map: Might change!
mapStream()
Flyd on: Might change!
streamOn()
Flyd scan: Might change!
scanStream()
Flyd merge: Might change!
mergeStream()
Flyd transduce: Might change!
transduceStream()
Polymorphic helper: Might change!
createPolymorphic()
Same as new Alo
createAlo()
Access to the util namespace
util
Access to the store constructor
createReducer()
Access to the subscription constructor
createReducer()
Same as new Reducer
createReducer()
Access to the handler constructor
createReducer()
Instanceof check for reducers
Parameters
reducer (any)
Argument to check if it is a reducer
Returns
boolean:
true of it is a reducer, false in the other case
Same as new Store
createStore()
Instanceof check for stores
isStore(store: any, validateId: any):
boolean
Parameters
store (any)
Argument to check if it is a store
Returns
boolean:
true of it is a store, false in the other case
Creates a typecheck function which throws an error if the typechecker returns false
createTypecheck(isType: function (value: any):
boolean, type:
string): function (value: any): (
boolean | void)
Parameters
isType (function (value: any): boolean)
Returns
function (value: any): (boolean | void)
Throws an error of type is not a string
isString(value: any): (
boolean | void)
Parameters
Returns
(boolean | void)
Reducer class
TODO: Describe what this class is all about
new Reducer()
Instance Members
Get id of this reducer
getId
Returns
string:
Unique ID of this reducer
▸
addStore(store, fromStore)
Connect one or multible stores to this reducer
Parameters
store ((Store | array))
One store or array of stores
fromStore (boolean)
Was this function called within a store
Returns
Reducer:
this
▸
removeStore(store, fromStore)
Remove a store or all stores from this reducer
Parameters
fromStore (boolean)
Was this called within a store?
Returns
Reducer:
this
Disables this reducer
Returns
Reducer:
this
Enables this reducer
Returns
Reducer:
this
Stops this reducer: it will be disabled and removed from all stores
Returns
Reducer:
this
Subscription Constructor, is used in the Store Class to create Subscriptions to state
Extends
Store
Parameters
The core of Alo. A store is the central place for application state
Parameters
state (Object)
Optional object to set as a start state
Instance Members
Reducers
_reducerRelations
Middlewares
_middlewareRelations
Subscriptions
_subscriptionRelations
Returns the id of the store
getId()
Returns the registered reducers
Returns
array:
Array of reducers
Adds a reducer object to the registered reducers
Parameters
Returns
Store:
this
Removes a reducer from the currently registered reducers
Parameters
reducer ((int | Reducer))
id or Reducer
Returns
Store:
this
Returns the registered middlewares
getMiddleware(id:
string?): (
array | Middleware |
false)
Parameters
id (string?)
The id is optional
Returns
(array | Middleware | false):
Array of middlewares, middleware with id, or false if middleware with id wasn't found
Registers one or multible middlewares on this store
Returns
Store:
this
Get a registered subscription by id
getSubscription()
Registers a subscription
addSubscription()
Removes a subscription
removeSubscription()
Creates and registers one or multible reducers
Returns
Reducer:
Returns the stream of this store
Returns
stream:
flyd stream
Returns the current state
Returns
object:
current state
Dispatches an action
Parameters
action ((function | object))
An untyped action function that returns payload, or an action object
Returns
Store:
this
Should be called in the constructor of the parent
constructParent(parentObject: any)
Parameters
Removes a middleware
removeMiddleware(id: (id | Middleware)):
Store
Parameters
id ((id | Middleware))
of middleware or middleware
Returns
Store:
this