當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript application.on函數代碼示例

本文整理匯總了TypeScript中application.on函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript on函數的具體用法?TypeScript on怎麽用?TypeScript on使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了on函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: setStatusBarColors

export function setStatusBarColors() {
  // Make the iOS status bar transparent with white text.
  if (application.ios) {
    application.on("launch", () => {
      utils.ios.getter(UIApplication, UIApplication.sharedApplication).statusBarStyle = UIStatusBarStyle.LightContent;
    });
  }

  // Make the Android status bar transparent.
  // See http://bradmartin.net/2016/03/10/fullscreen-and-navigation-bar-color-in-a-nativescript-android-app/
  // for details on the technique used.
  if (application.android) {
    application.android.onActivityStarted = function() {
      if (application.android && platform.device.sdkVersion >= "21") {
        const View = android.view.View;
        const window = application.android.startActivity.getWindow();
        window.setStatusBarColor(0x000000);

        const decorView = window.getDecorView();
        decorView.setSystemUiVisibility(
          View.SYSTEM_UI_FLAG_LAYOUT_STABLE
          | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
          | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
          | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
      }
    };
  }
}
開發者ID:EddyVerbruggen,項目名稱:sample-Groceries,代碼行數:28,代碼來源:status-bar-util.ts

示例2: ngAfterViewInit

 ngAfterViewInit() {
     app.on(app.resumeEvent, (args: app.ApplicationEventData) => {
         if (args.android) {
             const dld = new DeepLinkData("", args.android);
             this.launchExample();
         } else if (args.ios) {
             this.launchExample();
         }
     });
 }
開發者ID:yirony199,項目名稱:nativescript-sdk-examples-ng,代碼行數:10,代碼來源:app.component.ts

示例3:

import * as applicationModule from "application";
import * as frescoModule from "nativescript-fresco";

if (applicationModule.android) {
    applicationModule.on("launch", () => {
        frescoModule.initialize();
    });
}

applicationModule.start({ moduleName: "pages/main-page" });
開發者ID:ignaciolarranaga,項目名稱:nativescript-fresco,代碼行數:10,代碼來源:app.ts

示例4:

import * as app from 'application';
import { HockeyApp } from 'nativescript-hockey-sdk';

app.on(app.launchEvent, (args) => {
    // Init HockeyApp SDK
    HockeyApp.init();
});

app.start({ moduleName: 'main-page' });

/*
Do not place any code after the application has been started as it will not
be executed on iOS.
*/
開發者ID:toddanglin,項目名稱:nativescript-hockey-sdk,代碼行數:14,代碼來源:app.ts

示例5: require

import * as application from 'application';
import applicationSettingModule = require("application-settings");
var setString = applicationSettingModule.setString;

application.on(application.uncaughtErrorEvent, function(args) {

	if (args.ios) {
        console.log("NativeScriptError: " + args.ios);
        console.log("Stacktrace: " + args.ios.stack);
        setString("crash", args.ios + args.ios.stack);
	 }
    else if (args.android) {
		  console.log("NativeScriptError: " + args.android);
		  console.log("NativeScriptError: " + args.android.nativeException);
	      console.log("NativeScriptError: " + args.android.nativeException.getMessage());
	      setString("crash", args.android +
	                         args.android.nativeException +
	                         args.android.nativeException.getMessage());
    }
});

application.start({ moduleName: 'main-page' });
開發者ID:AntonioCuevaUrraco,項目名稱:nativescript-logEntries,代碼行數:22,代碼來源:app.ts

示例6: time

import * as application from "application";
import * as frame from "ui/frame";
import * as exampleBase from "./examples/example-base-page";
import * as prof from "./common/profiling";
import * as trace from "trace";
import * as utils from "utils/utils";
import { time, uptime } from "profiling";
import "nativescript-plugin-firebase";

import * as json from "~/package.json";
console.log("App config is: " + JSON.stringify(json));

application.on("displayed", () => {
  var now = time();
  var started = now - uptime();
  console.log("Timeline: Startup time...  (" + started + "ms. - " + now + "ms.)");
});

// The location of this import is important. iOS swizzles the app delegate.
import "./common/firebase";

if (application.android) {
    application.on("launch", args => {
        console.log("onLaunch");
        com.facebook.drawee.backends.pipeline.Fresco.initialize(application.android.context);
        application.android.on("activityStarted", ({activity}) => {
            console.log("onStarted");
            var window = activity.getWindow();
            if (window) {
                window.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(0xFF151F2F));
開發者ID:phattranky,項目名稱:nativescript-marketplace-demo,代碼行數:30,代碼來源:main-common.ts


注:本文中的application.on函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。