本文整理汇总了TypeScript中tns-core-modules/application.on函数的典型用法代码示例。如果您正苦于以下问题:TypeScript on函数的具体用法?TypeScript on怎么用?TypeScript on使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了on函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: quickActionCallback
(() => {
const iconHandler = args => {
if (!args || !args.android || !args.android.getAction) {
return;
}
const launchAction = args.android.getAction();
const isShortcutAction = launchAction && launchAction.indexOf(SHORTCUT_PREFIX) > -1;
if (isShortcutAction) {
// "clear" the intent
args.android.setAction("");
const quickAction = {
type: launchAction.substring(SHORTCUT_PREFIX.length)
};
if (quickActionCallback) {
quickActionCallback(quickAction);
} else {
lastQuickAction = quickAction;
}
}
};
application.on("launch", (args) => iconHandler(args));
})();
开发者ID:EddyVerbruggen,项目名称:nativescript-3dtouch,代码行数:26,代码来源:app-shortcuts.android.ts
示例2: Promise
return new Promise((resolve, reject) => {
if (_senderId !== null) {
resolve(_senderId);
}
const setSenderIdAndResolve = () => {
const senderIdResourceId = application.android.context.getResources().getIdentifier("gcm_defaultSenderId", "string", application.android.context.getPackageName());
if (senderIdResourceId === 0) {
throw new Error("####################### Seems like you did not include 'google-services.json' in your project! Firebase Messaging will not work properly. #######################");
}
_senderId = application.android.context.getString(senderIdResourceId);
resolve(_senderId);
};
if (!application.android.context) {
// throw new Error("Don't call this function before your app has started.");
appModule.on(appModule.launchEvent, () => setSenderIdAndResolve())
} else {
setSenderIdAndResolve();
}
});
开发者ID:NathanWalker,项目名称:nativescript-plugin-firebase,代码行数:21,代码来源:messaging.android.ts
示例3:
import { OptionsService } from "./navigation/options/options.service";
import { ExampleItemService } from "./navigation/exampleItemService.service";
import { ExamplesListDepthComponents } from "./navigation/examples-list/examples-list.component";
import { OptionsComponent } from "./navigation/options/options.component";
import { COMMON_DIRECTIVES } from './navigation/directives';
import { CommonDirectivesModule } from './navigation/directives/common-directives.module';
import { TNSImageModule } from "nativescript-image/angular";
// >> (hide)
import * as applicationModule from "tns-core-modules/application";
import * as imageModule from "nativescript-image";
if (applicationModule.android) {
applicationModule.on("launch", () => {
imageModule.initialize();
});
}
// << (hide)
@NgModule({
bootstrap: [
AppComponent
],
declarations: [
AppComponent,
ExamplesListDepthComponents,
OptionsComponent
],
imports: [
NativeScriptModule,
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:31,代码来源:app.module.ts
示例4: function
ďťżimport * as application from 'tns-core-modules/application';
application.on(application.launchEvent, function (args) {
if (args.android) {
// For Android applications, args.android is an android.content.Intent class.
console.log("Launched Android application with the following intent: " + args.android + ".");
} else if (args.ios !== undefined) {
// For iOS applications, args.ios is NSDictionary (launchOptions).
console.log("Launched iOS application with options: " + args.ios);
}
});
application.on(application.suspendEvent, function (args) {
if (args.android) {
// For Android applications, args.android is an android activity class.
console.log("Suspent Activity: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log("Suspent UIApplication: " + args.ios);
}
});
application.on(application.resumeEvent, function (args) {
if (args.android) {
// For Android applications, args.android is an android activity class.
console.log("Resume Activity: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log("Resume UIApplication: " + args.ios);
}
});
开发者ID:Notalib,项目名称:nativescript-audioplayer,代码行数:31,代码来源:app.ts
示例5: endsWith
import { on, resumeEvent, suspendEvent } from 'tns-core-modules/application';
export function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
export function nsArrayToJSArray(a) {
var arr = [];
if ("undefined" !== typeof a) {
var count = a.count;
for (var i = 0; i < count; i++) {
arr.push(a.objectAtIndex(i));
}
}
return arr;
}
export function newUUID(a?,b?){for(b=a='';a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):'-');return b}
let appSuspending = false;
on(suspendEvent, () => { appSuspending = true; });
on(resumeEvent, () => { appSuspending = false; });
export function isAppSuspending(): boolean {
return appSuspending;
}
开发者ID:alexziskind1,项目名称:nativescript-oauth,代码行数:27,代码来源:tns-oauth-utils.ts
示例6:
import { NgModule, NgModuleFactoryLoader, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { NativeScriptUISideDrawerModule } from "nativescript-ui-sidedrawer/angular";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { CoreModule } from "./core/core.module";
import * as fresco from "nativescript-fresco";
import * as application from "tns-core-modules/application";
if (application.android) {
application.on("launch", () => {
fresco.initialize({ isDownsampleEnabled: true });
});
}
@NgModule({
bootstrap: [
AppComponent
],
imports: [
AppRoutingModule,
NativeScriptModule,
NativeScriptUISideDrawerModule,
CoreModule,
CoreModule.forRoot(),
],
declarations: [
AppComponent
],
schemas: [
开发者ID:tonmoy-sardar,项目名称:banao.app,代码行数:31,代码来源:app.module.ts
示例7: require
ďťżimport "./bundle-config";
import * as application from 'tns-core-modules/application';
import { UnhandledErrorEventData } from "tns-core-modules/application";
// added this here so we can do some wiring
require("nativescript-plugin-firebase");
// testing this.. we may be able to hook that up to Crashlytics. Either via docs, or automatically.
application.on(application.uncaughtErrorEvent, (args: UnhandledErrorEventData) => {
console.log("[app.js]: Uncaught NativeScript Error: " + args.error);
});
application.run({ moduleName: "main-page" });
开发者ID:NathanWalker,项目名称:nativescript-plugin-firebase,代码行数:13,代码来源:app.ts
示例8:
import { routing } from "./app.routing";
import { OptionsService } from "./navigation/options/options.service";
import { ExampleItemService } from "./navigation/exampleItemService.service";
import { ExamplesListDepthComponents } from "./navigation/examples-list/examples-list.component";
import { OptionsComponent } from "./navigation/options/options.component";
import { COMMON_DIRECTIVES } from './navigation/directives';
import { CommonDirectivesModule } from './navigation/directives/common-directives.module';
import { TNSFrescoModule } from "nativescript-fresco/angular";
// >> (hide)
import * as applicationModule from "tns-core-modules/application";
import * as frescoModule from "nativescript-fresco";
if (applicationModule.android) {
applicationModule.on("launch", () => {
frescoModule.initialize();
});
}
// << (hide)
@NgModule({
bootstrap: [
AppComponent
],
declarations: [
AppComponent,
ExamplesListDepthComponents,
OptionsComponent,
],
imports: [
NativeScriptModule,
开发者ID:haylahi,项目名称:mobile-app,代码行数:31,代码来源:app.module.ts
注:本文中的tns-core-modules/application.on函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论