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

TypeScript browser-window.on函数代码示例

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

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



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

示例1: getMainWindow

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
        });

        browserWindow.loadURL('file://' + __dirname + '/../views/index.html');
        menu.setMenu(app, browserWindow);

        browserWindow.on('closed', (): void => browserWindow = null);

        browserWindow.webContents.on('did-finish-load', () => {
            browserWindow.show();
            browserWindow.focus();
        });
    }

    return browserWindow;
}
开发者ID:digideskio,项目名称:black-screen,代码行数:32,代码来源:Main.ts


示例2: function

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,代码行数:7,代码来源:main.ts


示例3: Promise

        return new Promise((resolve, reject) => {
            let auth_win = new BrowserWindow({
                width: 800,
                height: 600,
                'node-integration': false,
                'web-preferences': {
                    'node-integration': false,
                    'web-security': true,
                }
            });

            auth_win.on('close', function(){ auth_win = null; });

            const resolveCode = (event: Event, url: string) => {
                const raw_code = /code=([^&]*)/.exec(url) || null;
                const code = (raw_code && raw_code.length > 1) ? raw_code[1] : null;
                const error = /\?error=(.+)$/.exec(url);

                if (error) {
                    event.preventDefault();
                    console.log('login failed!');
                    setTimeout(() => auth_win.close(), 0);
                    reject(error);
                } else if (code) {
                    setTimeout(() => auth_win.close(), 0);
                    resolve(code);
                }
            }

            auth_win.webContents.on('will-navigate', (e: Event, u: string) => resolveCode(e, u));
            auth_win.webContents.on('did-finish-load', (e: Event) => resolveCode(e, auth_win.webContents.getUrl()));

            const url = 'https://github.com/login/oauth/authorize?client_id=' + CLIENT_ID;
            auth_win.loadUrl(url);
        }).then(this.authenticate.bind(this));
开发者ID:kdallafior,项目名称:Trendy,代码行数:35,代码来源:authentication.ts


示例4: BrowserWindow

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`);
          });
      });
  }

  // Open the devtools.
  // mainWindow.openDevTools();

  // Emitted when the window is closed.
  mainWindow.on('closed', () => {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });
});
开发者ID:ludamad,项目名称:boarders,代码行数:29,代码来源:ui-test-loader.ts


示例5: getMainWindow

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,
            },
            titleBarStyle: "hidden",
            resizable: true,
            minWidth: 500,
            minHeight: 300,
            width: workAreaSize.width,
            height: workAreaSize.height,
            show: false,
        };
        browserWindow = new browserWindowConstructor(options);

        browserWindow.loadURL("file://" + __dirname + "/../views/index.html");
        menu.setMenu(app, browserWindow);

        browserWindow.on("closed", (): void => browserWindow = undefined)
                     .on("focus", (): void => app.dock && app.dock.setBadge(""));

        browserWindow.webContents.on("did-finish-load", () => {
            browserWindow.show();
            browserWindow.focus();
        });
    }

    return browserWindow;
}
开发者ID:bj7,项目名称:black-screen,代码行数:34,代码来源:Main.ts


示例6: function

app.on('ready', function() {

  // ブラウザ(Chromium)の起動, 初期画面のロード
  mainWindow = new BrowserWindow({width: 800, height: 600});
  mainWindow.loadUrl('file://' + __dirname + '/../index.html');

  mainWindow.on('closed', function() {
    mainWindow = null;
  });
});
开发者ID:canvas-ncu,项目名称:image-arrager,代码行数:10,代码来源:main.ts


示例7: function

app.on('ready', function () {
    mainWindow = new BrowserWindow({
        'width': 601,
        'height': 600,
        'min-width': 601,
        'min-height': 600,
        frame: false
    });

    mainWindow.loadUrl(`file://${__dirname}/windows/index.html`);
    // mainWindow.openDevTools();
    mainWindow.on('closed', function () {
        mainWindow = null;
    });
});
开发者ID:elartix,项目名称:TodoistElectron,代码行数:15,代码来源:app.ts


示例8: function

app.on('ready', function() {
	// Create the browser window.
	mainWindow = new BrowserWindow({ width: 800, height: 600 });

	// and load the index.html of the app.
	mainWindow.loadUrl('file://' + __dirname + '/../lib/views/index.html');

	// Emitted when the window is closed.
	mainWindow.on('closed', function() {
		// Dereference the window object, usually you would store windows
		// in an array if your app supports multi windows, this is the time
		// when you should delete the corresponding element.
		mainWindow = null;
	});
});
开发者ID:jedmao,项目名称:design,代码行数:15,代码来源:main.ts


示例9: require

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,代码行数:18,代码来源:main.ts


示例10: function

app.on('ready', function () {
	mainWindow = new BrowserWindow({
		width: 1024,
		height: 768,
		resizable: true
	});

	shell = new shellModule.ShellModel(utils.getUserHome());
	shell.registerCallback();
	// mainWindow.openDevTools();
	mainWindow.loadUrl(`file://${__dirname}/../static/index.html`);

	mainWindow.on('closed', function () {
		// deref the window
		// for multiple windows store them in an array
		shell = null;
		mainWindow = null;
	});
});
开发者ID:schultyy,项目名称:jsterm,代码行数:19,代码来源:index.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript browserify.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript browser-window.loadUrl函数代码示例发布时间: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