小编emm*_*ose的帖子

如何在Cordova / Ionic项目中的deviceready事件中注册代码?

我正在接管Cordova / Ionic项目。我以前从未与Cordova或Ionic一起工作过,所以我是该领域的初学者。但是,我已经和Node一起工作了几年,所以我对此最了解。

一个简单的开始任务,我需要添加Appsee:

https://www.appsee.com/docs/ios/ionic

这部分很简单:

In case you're using TypeScript (default in ionic 2 and ionic 3) place the following line under the imports:

declare var Appsee:any;
Run Code Online (Sandbox Code Playgroud)

我放在这个文件中:

./src/app/app.component.ts

但是这一部分不太明显:

Call the following method when your app starts, preferably when the deviceready event fires:

Appsee.start("YOUR API KEY");
Run Code Online (Sandbox Code Playgroud)

所以我运行grep来查找deviceready在哪里:

grep -iR "deviceready" *   | grep -v node_modules

www/build/vendor.js:     * resolve when Cordova triggers the `deviceready` event.
www/build/vendor.js:            // prepare a custom "ready" for cordova "deviceready"
www/build/vendor.js:                    doc.addEventListener('deviceready', function () { …
Run Code Online (Sandbox Code Playgroud)

cordova ionic-framework

2
推荐指数
1
解决办法
2507
查看次数

标签 统计

cordova ×1

ionic-framework ×1