UNPKG

sdg

Version:

pomelo ts

42 lines (41 loc) 1.23 kB
import { IReceiveId, SID, IRoute, IRspData } from './IConnector'; import Application from '../application'; export interface IPushScheduler { /** * Component lifecycle callback */ start(): void; /** * Component lifecycle function * @return {void} */ stop(): void; /** * 调度发生时调用 */ schedule(route: IRoute, data: IRspData, receiveIds: IReceiveId[], opts: IScheduleOpts): void; } export interface IBroadcastOpts { binded?: boolean; filterParam?: any; } export interface IScheduleOpts { type?: 'broadcast' | 'response'; userOptions?: IBroadcastOpts; } export declare type IPushSelector = (route: string, msg: any, sids: SID[], opts: any) => number; export declare type IPushSchedulerOrCtor = { new (app: Application, opts?: any): IPushScheduler; } | IPushScheduler; export interface SinglePushScheduler { scheduler?: IPushSchedulerOrCtor; } export interface MultiPushSchedulerOptions { scheduler?: { id: number; scheduler: IPushSchedulerOrCtor; options: IPushSchedulerOptions; }[]; selector?: IPushSelector; } export declare type IPushSchedulerOptions = SinglePushScheduler | MultiPushSchedulerOptions;