當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。