-
Dispatches a generic
Dispatchableitem. This is useful for customizing Katana’s dispatchable, for example in other libraries.Declaration
Swift
@discardableResult func anyDispatch(_ dispatchable: Dispatchable) -> Promise<Any>Parameters
dispatchablethe item to dispatch
Return Value
a promise that is resolved when the dispatchable is handled by the store, resolving to a value associated with the dispatchable
-
Dispatches an
AnyStateUpdateritemDeclaration
Swift
@discardableResult func dispatch<T>(_ dispatchable: T) -> Promise<Void> where T : AnyStateUpdaterParameters
dispatchablethe State Updater to dispatch
Return Value
a promise that is resolved when the dispatchable is handled by the store
-
Dispatches an
AnySideEffectitemDeclaration
Swift
@discardableResult func dispatch<T>(_ dispatchable: T) -> Promise<Void> where T : AnySideEffectParameters
dispatchablethe State Updater to dispatch
Return Value
a promise that is resolved when the dispatchable is handled by the store
-
Dispatches a
ReturningSideEffectitemDeclaration
Swift
@discardableResult func dispatch<T>(_ dispatchable: T) -> Promise<T.ReturnValue> where T : ReturningSideEffectParameters
dispatchablethe Returning Side Effect to dispatch
Return Value
a promise parameterized to the side effect’s return value, that is resolved when the dispatchable is handled by the store
-
Adds a listener to the store. A listener is basically a closure that is invoked every time the Store’s state changes
Declaration
Swift
func addAnyListener(_ listener: @escaping AnyStoreListener) -> StoreUnsubscribeParameters
listenerthe listener closure
Return Value
a closure that can be used to remove the listener
View on GitHub
AnyStore Protocol Reference