未触发本机脚本应用程序事件

时间:2019-05-06 04:03:20

标签: nativescript angular2-nativescript

我已经为main.ts中的应用程序暂停和恢复事件进行了编码,但未触发该事件。我已经通过以下链接https://docs.nativescript.org/angular/core-concepts/application-lifecycle#use-application-events

关注了文档

我的Main.ts内容供您参考

import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { AppModule } from "./app.module";
import { on as applicationOn, suspendEvent, resumeEvent, ApplicationEventData } from "tns-core-modules/application";


applicationOn(suspendEvent, (args: ApplicationEventData) => {
    if (args.ios) {
        console.log("suspendEvent triggered");
    }
});

applicationOn(resumeEvent, (args: ApplicationEventData) => {
    if (args.ios) {
        console.log("resumeEvent triggered");
    }
});

platformNativeScriptDynamic().bootstrapModule(AppModule);

0 个答案:

没有答案