本文整理汇总了TypeScript中electron.ipcRenderer.sendSync方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ipcRenderer.sendSync方法的具体用法?TypeScript ipcRenderer.sendSync怎么用?TypeScript ipcRenderer.sendSync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.ipcRenderer
的用法示例。
在下文中一共展示了ipcRenderer.sendSync方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: do_ping
do_ping() {
if (this.has_ipc) {
console.log(ipcRenderer.sendSync('synchronous-message', 'sync ping')); // prints "pong"
ipcRenderer.send('asynchronous-message', 'async ping');
} else {
console.log("There isn't Electron main process.");
}
}
示例2: Player
process.once('loaded', () => {
let themeConfig = ipcRenderer.sendSync('get-theme-settings');
let themeSettings: BowtiePlist = themeConfig && themeConfig.settings ? themeConfig.settings : {};
let player = new Player(themeSettings);
let bowtie = new Bowtie();
global.iTunes = player;
global.Player = player;
global.Bowtie = bowtie;
global.onload = () => {
global.document.body.addEventListener('contextmenu', (e) => {
e.preventDefault();
menu.popup(remote.getCurrentWindow());
});
global.document.body.addEventListener('mousewheel', (e) => {
e.preventDefault();
handleScroll(e);
});
};
ipcRenderer.on('error', (...args) => {
handleError('Unknown', args);
});
});
示例3: BrowserWindow
import {
ipcRenderer,
remote,
webFrame,
clipboard,
crashReporter,
nativeImage,
screen,
shell
} from 'electron';
import * as fs from 'fs';
// In renderer process (web page).
// https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')); // prints "pong"
ipcRenderer.on('asynchronous-reply', (event: Electron.IpcRendererEvent, arg: any) => {
console.log(arg); // prints "pong"
event.sender.send('another-message', 'Hello World!');
});
ipcRenderer.send('asynchronous-message', 'ping');
// remote
// https://github.com/atom/electron/blob/master/docs/api/remote.md
var BrowserWindow = remote.BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
win.loadURL('https://github.com');
示例4: startGame
import {Module} from 'vuex'
import {IRootState} from '../index'
import {IRunningGame} from '../../../main/service/game'
import {ipcRenderer} from 'electron'
export interface IProcessState {
processes: IRunningGame[]
}
const store: Module<IProcessState, IRootState> = {
namespaced: true,
state: {
processes: ipcRenderer.sendSync('game:running'),
},
mutations: {
startGame(state, {name, json, id}) {
state.processes.push({
name, json, id, launcher: null,
})
},
onGameStop(state, {id}) {
const index = state.processes.findIndex((value) => {
if (value.id === id) return true
})
if (index === -1) return
state.processes.splice(index, 1)
}
},
}
示例5: sendWillQuitSync
export function sendWillQuitSync() {
// eslint-disable-next-line no-sync
ipcRenderer.sendSync('will-quit')
}
示例6: platform
export const bootstrapElectronRenderer = () => {
electron.ipcRenderer.sendSync(ELECTRON_READY);
platform([WORKER_RENDER_PLATFORM]).application([WORKER_RENDER_APPLICATION])
}
示例7: ngOnInit
ngOnInit() {
this.slideServie.setText(ipcRenderer.sendSync('RequestPrintText'));
this.pages = _.range(1, this.slideServie.getMaxPage() + 1);
}
示例8:
import { ipcRenderer } from "electron";
interface IElectron {
electron: {
ipc: Electron.IpcRenderer
app: {
version: string
userDataPath: string
}
}
}
const w: any = window
const obj: IElectron = {
electron: {
ipc: ipcRenderer,
app: {
version: ipcRenderer.sendSync('pitboom', 'get-app-version'),
userDataPath: ipcRenderer.sendSync('pitboom', 'get-app-user-data-path'),
},
}
}
w.electron = obj.electron