本文整理匯總了TypeScript中electron.app.setAppUserModelId方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript app.setAppUserModelId方法的具體用法?TypeScript app.setAppUserModelId怎麽用?TypeScript app.setAppUserModelId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.app
的用法示例。
在下文中一共展示了app.setAppUserModelId方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
app.on("will-finish-launching", () => {
app.setAppUserModelId(appUserModelId);
});
示例2: startAutoUpdateCheck
function startAutoUpdateCheck() {
checkSoftwareUpdate()
return setInterval(checkSoftwareUpdate, 3600000) // Check every hour
}
/*===== End of Auto update ======*/
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win: any
let tray: any = null
var DOM_READY: boolean = false
// Fix for enabling Windows notifications.
if (process.platform === 'win32') {
elc.app.setAppUserModelId(process.execPath)
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
elc.app.on('ready', main)
// Quit when all windows are closed.
elc.app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
// if (process.platform !== 'darwin' && process.platform !== 'win32') {
// elc.app.quit()
// }
})
示例3: electronDebug
import ensureOnline from './ensure-online';
import './touch-bar'; // eslint-disable-line import/no-unassigned-import
ipcMain.setMaxListeners(100);
electronDebug({
enabled: true, // TODO: This is only enabled to allow `Command+R` because messenger sometimes gets stuck after computer waking up
showDevTools: false
});
electronDl();
electronContextMenu();
const domain = config.get('useWorkChat') ? 'facebook.com' : 'messenger.com';
app.setAppUserModelId('com.sindresorhus.caprine');
// Disables broken color space correction in Chromium.
// You can see differing background color on the login screen.
// https://github.com/electron/electron/issues/9671
app.commandLine.appendSwitch('disable-color-correct-rendering');
if (!config.get('hardwareAcceleration')) {
app.disableHardwareAcceleration();
}
if (!isDev) {
log.transports.file.level = 'info';
autoUpdater.logger = log;
const FOUR_HOURS = 1000 * 60 * 60 * 4;
示例4: as
// - Update.exe
// - app-VERSION
// - OUREXE.exe
//
// Squirrel itself will always set the shortcut's App User Model ID to the
// form `com.squirrel.PACKAGE-NAME.OUREXE`. We need to call
// app.setAppUserModelId with a matching identifier so that renderer processes
// will inherit this value.
const updateDotExe = path.join(path.dirname(process.execPath), '..', 'update.exe')
if (fs.existsSync(updateDotExe)) {
const packageDir = path.dirname(path.resolve(updateDotExe))
const packageName = path.basename(packageDir).replace(/\s/g, '')
const exeName = path.basename(process.execPath).replace(/\.exe$/i, '').replace(/\s/g, '')
app.setAppUserModelId(`com.squirrel.${packageName}.${exeName}`)
}
}
// Map process.exit to app.exit, which quits gracefully.
process.exit = app.exit as () => never
// Load the RPC server.
require('@electron/internal/browser/rpc-server')
// Load the guest view manager.
require('@electron/internal/browser/guest-view-manager')
require('@electron/internal/browser/guest-window-manager')
// Now we try to load app's package.json.
let packagePath = null
示例5: getLogger
// https://github.com/atom/atom/blob/ce18e1b7d65808c42df5b612d124935ab5c06490/src/main-process/squirrel-update.js
import {app} from 'electron';
import * as cp from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import {SpawnCallback, SpawnError} from '../interfaces/';
import {getLogger} from '../logging/getLogger';
import * as EnvironmentUtil from '../runtime/EnvironmentUtil';
import * as lifecycle from '../runtime/lifecycle';
import * as config from '../settings/config';
app.setAppUserModelId(`com.squirrel.wire.${config.NAME.toLowerCase()}`);
const logger = getLogger('squirrel');
const appFolder = path.resolve(process.execPath, '..');
const rootFolder = path.resolve(appFolder, '..');
const updateDotExe = path.join(rootFolder, 'Update.exe');
const exeName = `${config.NAME}.exe`;
const linkName = `${config.NAME}.lnk`;
const windowsAppData = process.env.APPDATA || '';
if (!windowsAppData && EnvironmentUtil.platform.IS_WINDOWS) {
logger.error('No Windows AppData directory found.');
}
示例6: initDebug
// Initialize the debug mode handler when starting the app
initDebug()
if (!is.development) {
log.transports.file.level = 'info'
autoUpdater.logger = log
const UPDATE_CHECK_INTERVAL = 60000 * 60 * 3 // 3 Hours
setInterval(() => {
autoUpdater.checkForUpdates()
}, UPDATE_CHECK_INTERVAL)
autoUpdater.checkForUpdates()
}
app.setAppUserModelId('dev.timche.gmail-desktop')
let mainWindow: BrowserWindow
let replyToWindow: BrowserWindow
let isQuitting = false
let tray: Tray
const platform = utils.platform({
macos: 'macos',
linux: 'linux',
windows: 'windows'
})
if (!app.requestSingleInstanceLock()) {
app.quit()
}
示例7: createMainWindow
}
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (mainWindow === null) {
createMainWindow()
}
})
app.setAppUserModelId('com.squirrel.laskutus-electron.laskutus-electron')
function initAutoUpdates() {
if (os.platform() === 'linux') {
return
}
autoUpdater.addListener('update-downloaded', () => {
log('update downloaded')
const notificationWindow = new BrowserWindow(
{parent: mainWindow, width: 400, height: 600, modal: true})
notificationWindow.loadURL(
`file://${__dirname}/ui/update-notification.html`)
ipcMain.once('close-notification-window', () => {