Lightcord/DiscordJS/src/util/modules/dispatcher.ts

48 lines
1.6 KiB
TypeScript

import { requireModule } from "../DiscordToModules";
export = requireModule(m=>m.Dispatcher&&m.default&&m.default.dispatch) as {
_subscriptions: any,
_waitQueue: (() => void)[],
_processingWaitQueue: boolean,
_currentDispatchActionType: string | null,
_orderedActionHandlers: any,
_orderedCallbackTokens: any,
_lastID: number,
_dependencyGraph: any
isDispatching():boolean,
/**
* If the dispatcher isn't dispatching, then dispatch
*/
maybeDispatch(event: {type: string, [k: string]:any}):void,
/**
* Wait until the dispatcher finished dispatching, then dispatch
*/
dirtyDispatch(event: {type: string, [k: string]:any}):void,
/**
* dispatch
*/
dispatch(event: {type: string, [k: string]:any}):void,
/** Same as dispatcher.dispatch */
_dispatch(event: {type: string, [k: string]:any}):void,
/**
* Intercept events before they happens, if returning true, then the event will be blocked from dispatching.
*/
setInterceptor(interceptor: (event) => boolean):void,
/**
* Wait until the dispatcher has finished dispatching
*/
wait(waiting: () => void):void,
/** Subscribe to an event */
subscribe(event: string, listener: (event: {type: string, [k: string]:any}) => void):void,
/**
* Unsubscribe from the event.
*/
unsubscribe(event: string, listener: (event: {type: string, [k: string]:any}) => void):void,
register(name: string, actionHandler: any, storeDidChange: any):void
addDependencies,
_invalidateCaches,
_processWaitQueue,
_computeOrderedActionHandlers,
_computeOrderedCallbackTokens
}