@hyext/utils
Version:
A tools lib for huya miniapp business development
44 lines (43 loc) • 1.56 kB
TypeScript
export declare type NoticeInfo = {
noticeKey: string;
showTime?: number;
reportParams?: {
[key: string]: any;
};
};
export declare type Callback = (info?: NoticeInfo) => void;
export declare type GetReporterFn = (params: {
env: 'production' | 'test';
liveroomPopupKey: string;
logger?: (msg: string) => void;
}) => {
on_set: () => void;
on_show: () => void;
on_hide: () => void;
on_timeout: () => void;
on_click?: () => void;
};
export declare type SetModeWithQueueFn = (params: {
mode: string;
onShow?: Callback;
onNoticeHide?: Callback;
showTime?: number;
liveroomPopupKey?: string;
waitAfterResetNormal?: number;
skipResetNormal?: boolean;
shouldSkipPrevEvents?: boolean | ((payload: {
prevPopupKey?: string;
prevMode?: string;
mode: string;
liveroomPopupKey?: string;
}) => Promise<boolean>);
} & {
[key: string]: any;
}) => Promise<any>;
/**
* 一个高阶函数, 调用后返回 setModeWithQueue 函数
* 这个高阶函数每次调用都会取消监听 noticeShow/noticeHide 事件, 再重新进行监听
*/
export declare function getSetModeWithQueueFn(polyfillSDK?: any, logger?: (msg: string) => void): SetModeWithQueueFn;
export declare function getSetModeWithQueueFn(logger: (msg: string) => void): SetModeWithQueueFn;
export declare function getSetModeWithQueueFn(logger: (msg: string) => void, env: 'production' | 'test', getReporter: GetReporterFn): SetModeWithQueueFn;