danmu
Version:
Flexible, cross-platform, powerful danmu library.
79 lines (78 loc) • 2.61 kB
TypeScript
import type { Nullable } from 'aidly';
import {
SyncHook,
AsyncHook,
SyncWaterfallHook,
PluginSystem,
} from 'hooks-plugin';
import type { Manager } from './manager';
import type {
Danmaku,
DanmakuType,
DanmakuPlugin,
ManagerOptions,
} from './types';
export declare function createDanmakuLifeCycle<
T extends Danmaku<any>,
>(): PluginSystem<{
hide: SyncHook<[T], null, void>;
show: SyncHook<[T], null, void>;
pause: SyncHook<[T], null, void>;
resume: SyncHook<[T], null, void>;
beforeMove: SyncHook<[T], null, void>;
moved: SyncHook<[T], null, void>;
createNode: SyncHook<[T, HTMLElement], null, void>;
appendNode: SyncHook<[T, HTMLElement], null, void>;
removeNode: SyncHook<[T, HTMLElement], null, void>;
beforeDestroy: AsyncHook<[T, unknown], null>;
destroyed: SyncHook<[T, unknown], null, void>;
}>;
export declare function createManagerLifeCycle<T>(): PluginSystem<{
$show: SyncHook<[Danmaku<T>], null, void>;
$hide: SyncHook<[Danmaku<T>], null, void>;
$pause: SyncHook<[Danmaku<T>], null, void>;
$resume: SyncHook<[Danmaku<T>], null, void>;
$beforeMove: SyncHook<[Danmaku<T>], null, void>;
$moved: SyncHook<[Danmaku<T>], null, void>;
$createNode: SyncHook<[Danmaku<T>, HTMLElement], null, void>;
$appendNode: SyncHook<[Danmaku<T>, HTMLElement], null, void>;
$removeNode: SyncHook<[Danmaku<T>, HTMLElement], null, void>;
$beforeDestroy: AsyncHook<[Danmaku<T>, unknown], null>;
$destroyed: SyncHook<[Danmaku<T>, unknown], null, void>;
format: SyncHook<[], null, void>;
start: SyncHook<[], null, void>;
stop: SyncHook<[], null, void>;
show: SyncHook<[], null, void>;
hide: SyncHook<[], null, void>;
freeze: SyncHook<[], null, void>;
unfreeze: SyncHook<[], null, void>;
finished: SyncHook<[], null, void>;
clear: SyncHook<[Nullable<DanmakuType>], null, void>;
mount: SyncHook<[HTMLElement], null, void>;
unmount: SyncHook<[HTMLElement | null], null, void>;
init: SyncHook<
[manager: Manager<T, Record<PropertyKey, unknown>>],
null,
void
>;
limitWarning: SyncHook<[DanmakuType, number], null, void>;
push: SyncHook<[T | Danmaku<T>, DanmakuType, boolean], null, void>;
render: SyncHook<[DanmakuType], null, void>;
updateOptions: SyncHook<
[Partial<ManagerOptions>, Nullable<keyof ManagerOptions>],
null,
void
>;
willRender: SyncWaterfallHook<
{
type: DanmakuType;
prevent: boolean;
danmaku: Danmaku<T>;
trackIndex: null | number;
},
null
>;
}>;
export declare function createDanmakuPlugin<T>(
plSys: Manager<T>['pluginSystem'],
): DanmakuPlugin<T>;