当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript shell.openItem方法代码示例

本文整理汇总了TypeScript中electron.shell.openItem方法的典型用法代码示例。如果您正苦于以下问题:TypeScript shell.openItem方法的具体用法?TypeScript shell.openItem怎么用?TypeScript shell.openItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.shell的用法示例。


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

示例1: async

  watcher.on(actions.probeCave, async (store, action) => {
    const { caveId } = action.payload;

    const caveLogPath = paths.caveLogPath(caveId);
    logger.info(`Opening cave log path ${caveLogPath}`);
    shell.openItem(caveLogPath);
  });
开发者ID:HorrerGames,项目名称:itch,代码行数:7,代码来源:probe-cave.ts

示例2: open

export function open(folder: string) {
  if (os.platform() === "darwin") {
    // openItem will open the finder but it will appear *under* the app
    // which is a bit silly, so we just reveal it instead.
    shell.showItemInFolder(folder);
  } else {
    shell.openItem(folder);
  }
}
开发者ID:HorrerGames,项目名称:itch,代码行数:9,代码来源:explorer.ts

示例3: openDirectorySafe

export function openDirectorySafe(path: string) {
  if (__DARWIN__) {
    const directoryURL = Url.format({
      pathname: path,
      protocol: 'file:',
      slashes: true,
    })

    shell.openExternal(directoryURL)
  } else {
    shell.openItem(path)
  }
}
开发者ID:Ahskys,项目名称:desktop,代码行数:13,代码来源:shell.ts

示例4: callback

 fs.writeFile(pdfPath, data, _error_fs => {
   notificationSystem.addNotification({
     title: "PDF exported",
     message: `Notebook ${basepath} has been exported as a pdf.`,
     dismissible: true,
     position: "tr",
     level: "success",
     action: {
       label: "Open PDF",
       callback() {
         shell.openItem(pdfPath);
       }
     }
   });
 });
开发者ID:nteract,项目名称:nteract,代码行数:15,代码来源:menu.ts

示例5: updateMenu


//.........这里部分代码省略.........
This is the custom styles file where you can add anything you want.
The styles here will be injected into Caprine and will override default styles.
If you want to disable styles but keep the config, just comment the lines that you don't want to be used.

Here are some dark mode color variables to get you started.
Edit them to change color scheme of Caprine.
Press Command/Ctrl+R in Caprine to see your changes.
*/

:root {
	--base: #000;
	--base-ninety: rgba(255, 255, 255, 0.9);
	--base-seventy-five: rgba(255, 255, 255, 0.75);
	--base-seventy: rgba(255, 255, 255, 0.7);
	--base-fifty: rgba(255, 255, 255, 0.5);
	--base-fourty: rgba(255, 255, 255, 0.4);
	--base-thirty: rgba(255, 255, 255, 0.3);
	--base-twenty: rgba(255, 255, 255, 0.2);
	--base-five: rgba(255, 255, 255, 0.05);
	--base-ten: rgba(255, 255, 255, 0.1);
	--base-nine: rgba(255, 255, 255, 0.09);
	--container-color: #323232;
	--container-dark-color: #1e1e1e;
	--list-header-color: #222;
	--blue: #0084ff;
	--selected-conversation-background: linear-gradient(hsla(209, 110%, 45%, 0.9), hsla(209, 110%, 42%, 0.9));
}
`;

				if (!existsSync(filePath)) {
					writeFileSync(filePath, defaultCustomStyle, 'utf8');
				}

				shell.openItem(filePath);
			}
		}
	];

	const preferencesSubmenu: MenuItemConstructorOptions[] = [
		{
			label: 'Privacy',
			submenu: privacySubmenu
		},
		{
			label: 'Emoji Style',
			submenu: await generateEmojiSubmenu(updateMenu)
		},
		{
			label: 'Bounce Dock on Message',
			type: 'checkbox',
			visible: is.macos,
			checked: config.get('bounceDockOnMessage'),
			click() {
				config.set('bounceDockOnMessage', !config.get('bounceDockOnMessage'));
			}
		},
		{
			label: 'Mute Notifications',
			id: 'mute-notifications',
			type: 'checkbox',
			checked: config.get('notificationsMuted'),
			click() {
				sendAction('toggle-mute-notifications');
			}
		},
		{
开发者ID:nikteg,项目名称:caprine,代码行数:67,代码来源:menu.ts

示例6: async

 client.on(messages.ShellLaunch, async ({ itemPath }) => {
   shell.openItem(itemPath);
   return {};
 });
开发者ID:HorrerGames,项目名称:itch,代码行数:4,代码来源:perform-launch.ts

示例7: defaultMenu

export default function defaultMenu() {
    const template: Electron.MenuItemConstructorOptions[] = [
        {
            label: 'Edit',
            submenu: [
                {
                    label: 'New Tweet',
                    click(_, win) {
                        const w = getWindow(win);
                        if (w) {
                            w.webContents.send('tuitter:menu:new-tweet');
                        }
                    },
                },
                {
                    label: 'Edit Config',
                    click() {
                        shell.openItem(path.join(app.getPath('userData'), 'config.json'));
                    },
                },
                {
                    type: 'separator',
                },
                {
                    role: 'undo',
                },
                {
                    role: 'redo',
                },
                {
                    type: 'separator',
                },
                {
                    role: 'cut',
                },
                {
                    role: 'copy',
                },
                {
                    role: 'paste',
                },
                {
                    role: 'pasteandmatchstyle',
                },
                {
                    role: 'delete',
                },
                {
                    role: 'selectall',
                },
            ],
        },
        {
            label: 'View',
            submenu: [
                {
                    role: 'reload',
                },
                {
                    role: 'toggledevtools',
                },
                {
                    type: 'separator',
                },
                {
                    role: 'resetzoom',
                },
                {
                    role: 'zoomin',
                },
                {
                    role: 'zoomout',
                },
                {
                    type: 'separator',
                },
                {
                    role: 'togglefullscreen',
                },
            ],
        },
        {
            role: 'window',
            submenu: [
                {
                    role: 'minimize',
                },
                {
                    role: 'close',
                },
            ],
        },
        {
            role: 'help',
            submenu: [
                {
                    label: 'Learn More',
                    click() {
                        shell.openExternal('https://github.com/rhysd/Tui#readme');
                    },
//.........这里部分代码省略.........
开发者ID:rhysd,项目名称:Tui,代码行数:101,代码来源:default_menu.ts

示例8: handle

async function handle(type: ErrorType, e: Error) {
  if (catching) {
    logger.error(`While catching: ${e.stack || e}`);
    return;
  }
  catching = true;

  logger.error(
    `crash-reporter reporting: ${errorTypeString(type)}: ${e.stack}`
  );
  let res = await writeCrashLog(e);
  let log = res.log;
  let crashFile = res.crashFile;

  if (env.integrationTests) {
    logger.error(`Crash log written to ${res.crashFile}, bailing out`);
    exit(1);
    return;
  }

  const store = require("main/store").default;
  const i18n = store.getState().i18n;

  const buttons = [
    t(i18n, [
      "prompt.crash_reporter.report_issue",
      { defaultValue: "Report issue" },
    ]),
    t(i18n, [
      "prompt.crash_reporter.open_crash_log",
      {
        defaultValue: "Open crash log",
      },
    ]),
    t(i18n, ["prompt.action.close", { defaultValue: "Close" }]),
  ];
  if (env.development) {
    buttons.push("Ignore and continue");
  }
  let dialogOpts = {
    type: "error" as "error", // woo typescript is crazy stuff, friendos
    buttons,
    message: t(i18n, [
      "prompt.crash_reporter.message",
      {
        defaultValue: "The application has crashed",
      },
    ]),
    detail: t(i18n, [
      "prompt.crash_reporter.detail",
      {
        defaultValue: `A crash log was written to ${crashFile}`,
        location: crashFile,
      },
    ]),
  };

  const response = await new ItchPromise((resolve, reject) =>
    dialog.showMessageBox(dialogOpts, resolve)
  );

  if (response === 0) {
    reportIssue({ log });
  } else if (response === 1) {
    shell.openItem(crashFile);
  } else if (response === 3) {
    // ignore and continue
    return;
  }
  exit(1);

  catching = false;
}
开发者ID:itchio,项目名称:itch,代码行数:73,代码来源:crash-reporter.ts

示例9:

    socket.on('shell-openItem', (fullPath) => {
        const success = shell.openItem(fullPath);

        socket.emit('shell-openItemCompleted', success);
    });
开发者ID:E024,项目名称:Electron.NET,代码行数:5,代码来源:shell.ts

示例10: return

	return () => {
		return shell.openItem(app.getPath("userData"));
	};
开发者ID:ellcrys,项目名称:safehold,代码行数:3,代码来源:menu.ts


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