diff --git a/types/wepy/app.d.ts b/types/wepy/app.d.ts index cc2636ed92..9389b0400f 100644 --- a/types/wepy/app.d.ts +++ b/types/wepy/app.d.ts @@ -8,6 +8,25 @@ export interface AppConstructor { new (): app; } +/* the supported add-ons */ +export type AddOn = "requestfix" | "promisify"; + +export interface WindowConfig { + backgroundTextStyle: string; + navigationBarBackgroundColor: string; + navigationBarTitleText: string; + navigationBarTextStyle: string; +} + export default class app { - $init(wepy: any, config: AppConfig): any; + config: { + window: WindowConfig; + pages: string[]; + }; + $init(wepy: any, config: AppConfig): void; + use(addonName: AddOn, ...args: any[]): void; + $initAPI( + wepy: any, + noPromiseAPI: string[] | { [name: string]: boolean } + ): void; } diff --git a/types/wepy/wepy-tests.ts b/types/wepy/wepy-tests.ts index 9ed5462fb9..d9794f6e8b 100644 --- a/types/wepy/wepy-tests.ts +++ b/types/wepy/wepy-tests.ts @@ -1,5 +1,11 @@ import wepy from "wepy"; +export class MyApp extends wepy.app { + async onLoad() { + this.use("requestfix"); + } +} + export class MyComponent extends wepy.component { data = { reveal: false,