flux
namespace fluxFunctions
dispatch<A extends FluxAction<string>>(action: A & FluxActionOf<A["type"]>): Promise<void>
Sends a Flux action through Discord's dispatcher.
Returns
A promise that settles once Discord's stores handled the action.
getStore<K extends FluxStoreName>(name: K, options?: GetStoreOptions): FluxStoreOf<K>
Finds one of Discord's Flux stores by name. A store already loaded and cached is returned as itself; otherwise the
search is lazy unless { lazy: false } is passed, and runs on first access.
Returns
The store, typed from FluxStores, else as a base FluxStore.
interceptAction<K extends FluxActionType>(type: K, interceptor: FluxActionInterceptor<K>): () => void
Runs an interceptor before Discord handles each Flux action of one type. It may change the action, or drop it by returning true.
Returns
A function that removes the interceptor.
onAction<K extends FluxActionType>(type: K, listener: FluxActionListener<K>): () => void
Runs a listener for each Flux action of one type, after Discord's stores handle it.
Returns
A function that removes the listener.
onStoreChange(store: FluxStore, listener: FluxChangeListener): () => void
Runs a listener each time a Flux store changes.
Returns
A function that removes the listener.
useStore<S extends FluxStore | readonly FluxStore[], T>(stores: S, selector: (stores: S) => T, options?: UseStoreOptions<T>): T
Selects state from Flux stores in a component, re-rendering only when the selection changes.
Returns
The selector's latest value.
Interfaces
The payload of each Flux action, keyed by action type. Add your own with
declare module '@unbound-app/api/flux' { interface FluxActions { MY_ACTION: { id: string } } }.
The Flux stores flux.getStore knows, keyed by name without the Store suffix. Add your own with
declare module '@unbound-app/api/flux' { interface FluxStores { Message: MessageStore } }.
Types
Discord's ChannelStore.
The base shape of every Flux action.
Runs before Discord handles an action of one type. Returning true drops the action.
Runs for each dispatched action of one type.
The action Discord dispatches for type K: its FluxActions payload, else FluxAction.
An action type: one of FluxActions, or any other string.
Runs after a Flux store's state changed.
A Discord channel record.
A Discord guild record.
A guild member record.
A Discord message record.
The members every Flux store has. A store name missing from FluxStores gets this type.
A store name: one of FluxStores, or any other string.
The store type flux.getStore(name) returns: its FluxStores entry, else FluxStore.
A Discord user record.
A user's profile, loaded when their profile is opened.
Options for flux.getStore.
Discord's GuildMemberStore.
Discord's GuildSettingsStore, the state of the open server settings screen.
Discord's GuildStore.
Discord's RelationshipStore.
Discord's SelectedChannelStore.
Discord's TypingStore.
Discord's UserProfileStore.
Discord's UserStore.
Options for useStore.