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

TypeScript electron.app.commandLine类代码示例

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

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



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

示例1: configCanvasWorkaround

    configCanvasWorkaround() {
        if (this.loaded_config === null || !this.loaded_config.enable_canvas_workaround) {
            return;
        }

        // Note:
        // Avoid <canvas> rendering problem.
        //
        // https://github.com/rhysd/NyaoVim/issues/3
        // https://github.com/atom/electron/issues/4594
        //
        app.commandLine.appendArgument('--use-gl=egl');
        process.env.MESA_GLSL_VERSION_OVERRIDE = '1.30';
    }
开发者ID:silky,项目名称:NyaoVim,代码行数:14,代码来源:browser-config.ts


示例2: openMainBracketsWindow

export function openMainBracketsWindow(query: {} | string = {}): Electron.BrowserWindow {

    // compose path to brackets' index file
    const indexPath = "file:///" + convertWindowsPathToUnixPath(path.resolve(__dirname, "www", "index.html"));

    // build a query for brackets' window
    let queryString = "";
    if (_.isObject(query) && !_.isEmpty(query)) {
        const queryObj = query as _.Dictionary<string>;
        queryString = "?" + _.map(queryObj, function (value, key) {
            return key + "=" + encodeURIComponent(value);
        }).join("&");
    } else if (_.isString(query)) {
        const queryStr = query as string;
        const io1 = queryStr.indexOf("?");
        const io2 = queryStr.indexOf("#");
        if (io1 !== -1) {
            queryString = queryStr.substring(io1);
        } else if (io2 !== -1) {
            queryString = queryStr.substring(io2);
        } else {
            queryString = "";
        }
    }

    const indexUrl = indexPath + queryString;

    const winOptions = {
        title: appInfo.productName,
        x: shellConfig.getNumber("window.posX"),
        y: shellConfig.getNumber("window.posY"),
        width: shellConfig.getNumber("window.width"),
        height: shellConfig.getNumber("window.height"),
        webPreferences: {
            nodeIntegration: false,
            preload: path.resolve(__dirname, "preload.js")
        }
    };

    const bracketsPreferences = readBracketsPreferences();

    const blinkFeatures = _.get(bracketsPreferences, "shell.blinkFeatures");
    if (typeof blinkFeatures === "string" && blinkFeatures.length > 0) {
        _.set(winOptions, "webPreferences.blinkFeatures", blinkFeatures);
    }

    const disableBlinkFeatures = _.get(bracketsPreferences, "shell.disableBlinkFeatures");
    if (typeof disableBlinkFeatures === "string" && disableBlinkFeatures.length > 0) {
        _.set(winOptions, "webPreferences.disableBlinkFeatures", disableBlinkFeatures);
    }

    const smoothScrolling = _.get(bracketsPreferences, "shell.smoothScrolling", true);
    if (!smoothScrolling) {
        app.commandLine.appendSwitch("disable-smooth-scrolling");
    }

    // create the browser window
    const win = new BrowserWindow(winOptions);
    if (process.argv.indexOf("--devtools") !== -1) {
        win.webContents.openDevTools({ mode: "detach" });
    }
    wins.push(win);

    // load the index.html of the app
    log.info(`loading brackets window at ${indexUrl}`);
    win.loadURL(indexUrl);
    if (shellConfig.get("window.maximized")) {
        win.maximize();
    }

    // emitted when the window is closed
    win.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.
        const io = wins.indexOf(win);
        if (io !== -1) { wins.splice(io, 1); }
    });

    // this is used to remember the size from the last time
    // emitted before the window is closed
    win.on("close", function () {
        saveWindowPositionSync(win);
    });
    win.on("maximize", function () {
        saveWindowPosition(win);
    });
    win.on("unmaximize", function () {
        saveWindowPosition(win);
    });
    win.on("resize", function () {
        saveWindowPosition(win);
    });
    win.on("move", function () {
        saveWindowPosition(win);
    });

    return win;
}
开发者ID:zaggino,项目名称:brackets-electron,代码行数:99,代码来源:main.ts


示例3: async



process.on('uncaughtException', (error) => {
    appDelegate.preventQuit = true;

    logMonitor.logException(error);
    console.error('Uncaught Exception: ', error.toString());

    if (error.stack) {
        console.error(error.stack);
    }
});


if (!environment.production) {
    app.commandLine.appendSwitch('remote-debugging-port', '9229');
}


logMonitor.install('main-process');


app.once('ready', async () => {
    try {
        await appDelegate.run();
        console.log('START! 🤔');
    } catch (error) {
        console.error(error);
        process.exit(1);
    }
});
开发者ID:suiruiw,项目名称:geeks-diary,代码行数:29,代码来源:main.ts


示例4: it

 it('returns an empty string when not present', () => {
   expect(app.commandLine.getSwitchValue('foobar2')).to.equal('')
 })
开发者ID:malept,项目名称:electron,代码行数:3,代码来源:api-app-spec.ts


示例5: require

///<reference path="window/main.ts"/>
import { MessageServer, AppMessageServer } from './backgroundLibs/msg/msg';
import { AdBlocking } from './backgroundLibs/adblocking/adblocking';
import { Shortcuts } from './backgroundLibs/shortcuts/shortcuts';
import { RemoteServer }  from './backgroundLibs/remote/remote';
import { Settings } from './backgroundLibs/settings/settings';
import { Updater } from './backgroundLibs/updater/updater';
import { app, BrowserWindow, Tray, Menu } from 'electron';
import { log, error } from './backgroundLibs/log/log';
import AutoLaunch = require('auto-launch');
import path = require('path');
import url = require('url');

app.commandLine.appendSwitch('widevine-cdm-path', path.join(__dirname, 'widevine', 'widevinecdmadapter.dll'));
app.commandLine.appendSwitch('widevine-cdm-version', '1.4.8.984');

const appData = app.getPath('appData');
const logger = require('logger').createLogger(path.join(appData, 'media-app', 'log.log'));

export namespace MediaApp {
	let resolveBrowserWindow: (win: Electron.BrowserWindow) => void = null;

	export namespace Refs {
		export let tray: Electron.Tray = null;
		export let messageServer: MessageServer = null;
		export let idGenerator: AppMessageServer = null;
		export let activeWindow: Electron.BrowserWindow = null;
		export let activeWindowPromise: Promise<Electron.BrowserWindow> = new Promise((resolve) => {
			resolveBrowserWindow = resolve;
		});
		export const DEBUG = !!process.argv.filter(arg => arg.indexOf('debugging') > -1).length;		
开发者ID:SanderRonde,项目名称:youtube-music-app,代码行数:31,代码来源:app.ts


示例6: main

export function main() {
  mainLogger.info(
    `${env.appName}@${app.getVersion()} on electron@${
      process.versions.electron
    } in ${env.production ? "production" : "development"}`
  );

  if (process.env.CAPSULE_LIBRARY_PATH) {
    // disable acceleration when captured by capsule
    app.disableHardwareAcceleration();
  } else {
    try {
      const prefs = loadPreferencesSync();
      if (prefs.disableHardwareAcceleration) {
        app.disableHardwareAcceleration();
      }
    } catch (e) {
      // oh well
    }
  }

  if (env.production) {
    app.enableMixedSandbox();
  }

  // cf. https://github.com/itchio/itch/issues/2026
  app.commandLine.appendSwitch("ignore-connections-limit", "127.0.0.1");

  if (process.env.ITCH_IGNORE_CERTIFICATE_ERRORS === "1") {
    app.commandLine.appendSwitch("ignore-certificate-errors");
  }
  protocol.registerStandardSchemes(["itch-cave", "itch"]);

  let store: Store = require("main/store").default;

  let onReady = () => {
    if (!env.integrationTests) {
      const shouldQuit = app.makeSingleInstance((argv, cwd) => {
        // we only get inside this callback when another instance
        // is launched - so this executes in the context of the main instance
        store.dispatch(
          actions.processUrlArguments({
            args: argv,
          })
        );
        store.dispatch(actions.focusWind({ wind: "root" }));
      });
      if (shouldQuit) {
        app.exit(0);
        return;
      }
    }

    store.dispatch(
      actions.processUrlArguments({
        args: process.argv,
      })
    );

    globalShortcut.register("Control+Alt+Backspace", function() {
      store.dispatch(actions.forceCloseLastGame({}));
    });

    // Emitted when the application is activated. Various actions can trigger
    // this event, such as launching the application for the first time,
    // attempting to re-launch the application when it's already running, or
    // clicking on the application's dock or taskbar icon.
    app.on("activate", () => {
      store.dispatch(actions.focusWind({ wind: "root" }));
    });

    app.on("before-quit", e => {
      e.preventDefault();
      store.dispatch(actions.quit({}));
    });

    store.dispatch(actions.preboot({}));

    setInterval(() => {
      try {
        store.dispatch(actions.tick({}));
      } catch (e) {
        mainLogger.error(`While dispatching tick: ${e.stack}`);
      }
    }, 1 * 1000 /* every second */);
  };
  app.on("ready", onReady);

  app.on("will-finish-launching", () => {
    app.setAppUserModelId(appUserModelId);
  });

  // macOS (Info.pList)
  app.on("open-url", (e: Event, url: string) => {
    if (isItchioURL(url)) {
      // otherwise it'll err -600
      e.preventDefault();
      store.dispatch(actions.handleItchioURI({ uri: url }));
    }
  });
//.........这里部分代码省略.........
开发者ID:itchio,项目名称:itch,代码行数:101,代码来源:main.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript electron.app.dock类代码示例发布时间:2022-05-25
下一篇:
TypeScript electron.app类代码示例发布时间: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