@bytedance/mona
Version:
Merchant app's developing and building tools
38 lines (37 loc) • 1.25 kB
TypeScript
import React from 'react';
export type Callback<T = any> = (options?: T) => any;
export declare enum AppLifecycle {
launch = "onLaunch",
show = "onShow",
hide = "onHide",
error = "onError",
pageNotFound = "onPageNotFound",
unhandledRejection = "onUnhandledRejection"
}
export declare enum PageLifecycle {
load = "onLoad",
ready = "onReady",
show = "onShow",
hide = "onHide",
unload = "onUnload",
resize = "onResize",
pullDownRefresh = "onPullDownRefresh",
reachBottom = "onReachBottom",
shareAppMessage = "onShareAppMessage",
pageScroll = "onPageScroll"
}
export declare enum ComponentLifecycle {
created = "onCreated",
attached = "onAttached",
ready = "onReady",
moved = "onMoved",
detached = "onDetached"
}
export declare class LifecycleContext {
lifecycle: Record<string, Set<Callback>>;
constructor();
registerLifecycle(name: string, callback: Callback): (() => void) | undefined;
}
export declare const PageLifecycleGlobalContext: React.Context<LifecycleContext | null>;
export declare const AppLifecycleGlobalContext: React.Context<LifecycleContext | null>;
export declare const ComponentLifecycleGlobalContext: React.Context<LifecycleContext | null>;