• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript app.on函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中app.on函数的典型用法代码示例。如果您正苦于以下问题:TypeScript on函数的具体用法?TypeScript on怎么用?TypeScript on使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了on函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: Start

	/**
	 * start the application itself.
	 */
	public Start(): void {

		this.mainWindow = null;

		// quit when all windows are closed.
		app.on("window-all-closed", () => this.WindowAllClose() );

		// this method will be called when Electron has done everything
		// initialization and ready for creating browser windows.
		app.on("ready", () => this.Ready() );
	}
开发者ID:fforjan,项目名称:SimpleUML,代码行数:14,代码来源:application.ts


示例2: startIsolatedApp

function startIsolatedApp() {
    app.on('ready', () => {
        let win = new BrowserWindow({
            width: app_config.width,
            height: app_config.height,
        });

        win.loadUrl(index_html);

        let fetcher = new TrendFetcher(
                win.webContents,
                app_config.languages,
                app_config.proxy || undefined
            );
        auth.getToken().then((access_token: string) => {
            fetcher.setToken(access_token);
        });

        let app_icon = new Tray(normal_icon);
        const context_menu = Menu.buildFromTemplate([
            {
                label: 'Show Window',
                click: () => win.show(),
            },
            {
                label: 'Force Update',
                click: () => fetcher.doScraping(),
            },
            {
                label: 'Quit',
                accelerator: 'CmdOrCtrl+Q',
                click: () => app.quit(),
            }
        ]);
        app_icon.setContextMenu(context_menu);

        ipc.on('renderer-ready', () => fetcher.start());
        ipc.on('force-update-repos', () => fetcher.doScraping());
        ipc.on('tray-icon-normal', () => app_icon.setImage(normal_icon));
        ipc.on('tray-icon-notified', () => app_icon.setImage(notified_icon));
        ipc.on('start-github-login', () => doLogin(fetcher, win.webContents));

        if (app_config.hot_key !== '') {
            shortcut.register(
                    app_config.hot_key,
                    () => win.isVisible() ? win.hide() : win.show()
                );
        }
    });
}
开发者ID:kdallafior,项目名称:Trendy,代码行数:50,代码来源:main.ts


示例3: require

const app = require('app');
const BrowserWindow = require('browser-window');
const IPC = require('electron').ipcMain;
let menu = require('./Menu');

let browserWindow: any = null;

app.on('open-file', (event: Event, file: string) => getMainWindow().webContents.send('change-working-directory', file))
    .on('ready', getMainWindow)
    .on('activate-with-no-open-windows', getMainWindow)
    .on('mainWindow-all-closed', () => process.platform === 'darwin' || app.quit());

IPC.on('quit', app.quit);

function getMainWindow() {
    const workAreaSize = require('screen').getPrimaryDisplay().workAreaSize;

    if (!browserWindow) {
        browserWindow = new BrowserWindow({
            'web-preferences': {
                'experimental-features': true,
                'experimental-canvas-features': true,
                'subpixel-font-scaling': true,
                'overlay-scrollbars': true
            },
            resizable: true,
            'min-width': 500,
            'min-height': 300,
            width: workAreaSize.width,
            height: workAreaSize.height,
            show: false
开发者ID:digideskio,项目名称:black-screen,代码行数:31,代码来源:Main.ts


示例4: require

const app: Electron.App = require("app");
const browserWindowConstructor: typeof Electron.BrowserWindow = require("browser-window");
import {ipcMain, nativeImage} from "electron";
import menu from "./Menu";
let fixPath = require("fix-path");

let browserWindow: Electron.BrowserWindow = undefined;

// Fix the $PATH on OS X
fixPath();

if (app.dock) {
    app.dock.setIcon(nativeImage.createFromPath("icon.png"));
}

app.on("open-file", (event: Event, file: string) => getMainWindow().webContents.send("change-working-directory", file))
    .on("ready", getMainWindow)
    .on("activate", getMainWindow)
    .on("mainWindow-all-closed", () => process.platform === "darwin" || app.quit());

ipcMain.on("quit", app.quit);

function getMainWindow(): Electron.BrowserWindow {
    const screen: Electron.Screen = require("screen");
    const workAreaSize = screen.getPrimaryDisplay().workAreaSize;

    if (!browserWindow) {
        let options: Electron.BrowserWindowOptions = {
            webPreferences: {
                experimentalFeatures: true,
                experimentalCanvasFeatures: true,
开发者ID:Eugene-msc,项目名称:black-screen,代码行数:31,代码来源:Main.ts


示例5: require

/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/github-electron/github-electron-main.d.ts" />

import E = GitHubElectron;
var app : E.App = require('app');
var BrowserWindow : typeof E.BrowserWindow = require('browser-window');

app.on('window-all-closed', () => {
  app.quit();
});

app.on('ready', () => {
  var mainWindow = new BrowserWindow({ width: 800, height: 600 });
  mainWindow.on('closed', () => { mainWindow = null; });
  mainWindow.openDevTools();
  mainWindow.loadUrl('file://' + __dirname + '/../index.html');
});
开发者ID:omo,项目名称:hello2015,代码行数:17,代码来源:main.ts


示例6: require

/// <reference path="typings/browser/ambient/github-electron/electron-prebuilt/index.d.ts" />

'use sctrict';

const app = require('app');
const BrowserWindow = require('browser-window');
const mainWindow = null;

app.on('window-all-closed', function() {
  if (process.platform != 'darwin') {
    app.quit();
  }
});

app.on('ready', function() {
  mainWindow = new BrowserWindow({width: 800, height: 600});
  mainWindow.loadURL('file://' + __dirname + '/../html/index.html');
  mainWindow.on('closed', function() {
    mainWindow = null;
  });
})
开发者ID:KenjiOhtsuka,项目名称:brief-spread,代码行数:21,代码来源:main.ts


示例7: require

import {AppConfigService} from './frameworks/app.framework/services/app-config.service';

crashReporter.start({
  productName: 'Angular2SeedAdvanced',
  companyName: 'NathanWalker',
  submitURL: 'https://github.com/NathanWalker/angular2-seed-advanced',
  autoSubmit: true
});

if (process.env.NODE_ENV === 'development') {
  require('electron-debug')();
}

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('ready', () => {

  // Initialize the window to our specified dimensions
  mainWindow = new BrowserWindow({ width: 900, height: 620 });

  // Tell Electron where to load the entry point from
  mainWindow.loadURL('file://' + __dirname + '/index.html');

  // Clear out the main window when the app is closed
  mainWindow.on('closed', () => {
    mainWindow = null;
  });
开发者ID:TheLarkInn,项目名称:angular2-seed-advanced,代码行数:31,代码来源:main.desktop.ts


示例8: require

import * as path from 'path';
import * as app from 'app';
import * as BrowserWindow from 'browser-window';
import setMenu from './menu';

const index_html = 'file://' + path.join(__dirname, '..', '..', 'index.html');

app.on('ready', () => {
    const display_size = require('screen').getPrimaryDisplay().workAreaSize;

    let win = new BrowserWindow({
        width: display_size.width,
        height: display_size.height,
        'title-bar-style': 'hidden-inset',
    });

    win.on('closed', () => {
        win = null;
        app.quit();
    });

    win.loadUrl(index_html);

    setMenu();
});
开发者ID:rexfordkelly-on-JS,项目名称:Tilectron,代码行数:25,代码来源:main.ts


示例9: require

var Promise = require("promise");
import os = require("os");
import shellModule = require("./shellModel");
import userConfig = require("./user_configuration");
import utils = require('./utils');

// report crashes to the Electron project
require('crash-reporter').start();

// prevent window being GC'd
var mainWindow = null;
var shell = null;

app.on('window-all-closed', function () {
	if (process.platform !== 'darwin') {
		app.quit();
	}
});

ipc.on('platform', function(event, arg) {
  event.sender.send('platform', os.platform());
});

ipc.on('load-configuration', function(event, arg) {
  userConfig.loadConfiguration().then((config) => {
    event.sender.send('user-configuration', config);
  });
});

app.on('ready', function () {
	mainWindow = new BrowserWindow({
开发者ID:schultyy,项目名称:jsterm,代码行数:31,代码来源:index.ts


示例10: require

declare var __dirname:string;

var fs = require('fs');
var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is GCed.
var mainWindow = null;

// Quit when all windows are closed.
app.on('window-all-closed', () => app.quit());

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', () => {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600});

  // and load the index.html of the app.
  var [_, _, testName] = process.argv;
  if (testName === "index") {
      mainWindow.loadUrl(`file://${__dirname}/index.html`);
  } else {
      var fs = require('fs');
      fs.readFile(__dirname + "/ui-test.template.html", 'utf8', (err,data) => {
          var result = data.replace("$$ENTER_HERE$$", testName);
          fs.writeFile(`${__dirname}/ui-test-${testName}.html`, result, 'utf8', (err) => {
              mainWindow.loadUrl(`file://${__dirname}/ui-test-${testName}.html`);
          });
      });
开发者ID:ludamad,项目名称:boarders,代码行数:31,代码来源:ui-test-loader.ts



注:本文中的app.on函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript app.quit函数代码示例发布时间:2022-05-25
下一篇:
TypeScript app.directive函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap