$App
App registrar provided by the framework, with the same behavior as $App in @mptool/enhance.
import { $App } from "@mptool/skyline-enhance";
$App({
// your app options here
});Configuration
onAwake
Type:
function onAwake(time: number): void | Promise<void>;Parameters:
time: duration of this sleep, in ms
Called when the mini-program is brought back from the background.
Tips
onAwake relies on onShow and onHide to calculate the sleep duration. The framework wraps onLaunch / onShow / onHide; do not override these lifecycles after registration.
Injected properties
Event dispatch
The event dispatch members are all instance properties or methods of Emitter:
$on(type: string, handler: (event?: any) => void | Promise<void>): void: listen for thetypeevent$emit(type: string, event?: any): void: emit thetypeevent synchronously$emitAsync(type: string, event?: any): Promise<void>: emit thetypeevent asynchronously and accept a callback$off(type: string, handler?: (event?: any) => void | Promise<void>): void: remove thehandlerfortype, or all handlers whenhandleris omitted