npm i --save nativescript-launchkit
- 版本:0.1.2
- GitHub: https://github.com/sitefinitysteve/nativescript-launchkit
- NPM: https://npmjs.net.cn/package/nativescript-launchkit
- 下载次数
- 昨天: 0
- 上周: 0
- 上个月: 0
Nativescript LaunchKitSDK 包装器
设置
在您的 app.js 中添加以下代码
if (application.ios) {
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var appDelegate = (function (_super) {
__extends(appDelegate, _super);
function appDelegate() {
_super.apply(this, arguments);
}
appDelegate.prototype.applicationDidFinishLaunchingWithOptions = function (app, launchOptions) {
launchkit.initalize({
token: "OjMwhQZ5WgFFNZAQVBOYtWtAcXv1Kw2inxkzPEx_j6sK"
});
};
appDelegate.ObjCProtocols = [UIApplicationDelegate];
return appDelegate;
})(UIResponder);
application.ios.delegate = appDelegate;
}
API
var launchkit = require("nativescript-launchkit");
launchkit.initalize({
token: "", //From https://launchkit.io/sdk/install/,
debug: false //tells all methods that have debug flags to use them
});
isSuperUser: 返回布尔值
launchkit.isSuperUser();
launchkit.setUser({
id: "someid",
name: "steve",
email: "[email protected]"
});
showOnboarding: 返回 Promise (args: args)
launchkit.showOnboarding();
Onboarding 需要从视图调用,在 app.js 中调用将失败,因为没有 UIWindow
showReleaseNotes: 返回 Promise (args: didPresent)
launchkit.showAppReviewCard({
page: page //args.object from your onNavigatingTo, or onPageLoaded events
});
showAppReviewCard: 返回 Promise (args: didPresent, flowResult)
launchkit.showAppReviewCard({
page: page //args.object from your onNavigatingTo, or onPageLoaded events
});