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

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

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

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: BrowserWindow

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


示例7: 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


示例8: 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


示例9: invokeLangPicker

// Note: Ensure app is already ready
export default function invokeLangPicker(colors: {[lang: string]: string}) {
    let picker_win = new BrowserWindow({
        width: 600,
        height: 800,
    });

    picker_win.loadUrl('file://' + path.join(__dirname, '..', '..', 'langpicker.html'));
    picker_win.on('closed', function(){ picker_win = null; });

    picker_win.webContents.on('dom-ready', () => picker_win.webContents.send('lang-picker-data', colors));

    return new Promise(resolve => {
        ipc.on('picked-langs', (event: Event, langs: string[]) => {
            console.log('picked!: ' + JSON.stringify(langs));
            if (langs.length === 0) {
                langs.push('all');
            }
            resolve(langs);
        });
    }).catch(err => {
        console.log(err);
        return ['all']; // Fallback
    });
}
开发者ID:kdallafior,项目名称:Trendy,代码行数:25,代码来源:lang-picker.ts


示例10: BrowserWindow

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript browser-window.on函数代码示例发布时间: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