本文整理汇总了TypeScript中ipc.on函数的典型用法代码示例。如果您正苦于以下问题:TypeScript on函数的具体用法?TypeScript on怎么用?TypeScript on使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了on函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: registerCallback
registerCallback() {
ipc.on("execute-command", (event: any, arg: string) => {
this.execute(event, arg);
this.history.addCommand(arg);
});
ipc.on("last-command", (event: any, arg: string) => {
event.sender.send('last-history-command', this.history.lastCommand());
});
ipc.on("next-command", (event: any, arg: string) => {
event.sender.send('next-history-command', this.history.nextCommand());
});
}
示例2: BrowserWindow
app.on('ready', () => {
let win = new BrowserWindow({
width: app_config.width,
height: app_config.height,
});
win.loadUrl(index_html);
let fetcher = new TrendFetcher(
win.webContents,
app_config.languages,
app_config.proxy || undefined
);
auth.getToken().then((access_token: string) => {
fetcher.setToken(access_token);
});
let app_icon = new Tray(normal_icon);
const context_menu = Menu.buildFromTemplate([
{
label: 'Show Window',
click: () => win.show(),
},
{
label: 'Force Update',
click: () => fetcher.doScraping(),
},
{
label: 'Quit',
accelerator: 'CmdOrCtrl+Q',
click: () => app.quit(),
}
]);
app_icon.setContextMenu(context_menu);
ipc.on('renderer-ready', () => fetcher.start());
ipc.on('force-update-repos', () => fetcher.doScraping());
ipc.on('tray-icon-normal', () => app_icon.setImage(normal_icon));
ipc.on('tray-icon-notified', () => app_icon.setImage(notified_icon));
ipc.on('start-github-login', () => doLogin(fetcher, win.webContents));
if (app_config.hot_key !== '') {
shortcut.register(
app_config.hot_key,
() => win.isVisible() ? win.hide() : win.show()
);
}
});
示例3: Promise
return new Promise(resolve => {
ipc.on('picked-langs', (event: Event, langs: string[]) => {
console.log('picked!: ' + JSON.stringify(langs));
if (langs.length === 0) {
langs.push('all');
}
resolve(langs);
});
}).catch(err => {
示例4: require
$( document ).ready((): void => {
document.title = packageDescription.name;
editor = new UmlEditor.UmlEditor();
editor.setDocuments();
var ipc: any = require("ipc");
ipc.on("save", () => {
editor.saveDocument();
});
ipc.on("update", () => {
editor.renderJumlyDocument();
});
ipc.on("requestClipboardArea", () => {
editor.copyToClipboard();
});
});
示例5: constructor
constructor(props: {}) {
super(props);
this.application = new Application(this.charSize, this.contentSize);
this.application.activateTerminal(this.application.terminals[0]);
this.state = { terminals: this.application.terminals };
$(window).resize(() => this.application.contentSize = this.contentSize);
IPC.on('change-working-directory', (directory: string) =>
this.application.activeTerminal.currentDirectory = directory
);
}
示例6: TrendFetcher
menu_window.on('after-create-window', () => {
menu_window.tray.setToolTip('Show Menu Window');
let fetcher = new TrendFetcher(
menu_window.window.webContents,
app_config.languages,
app_config.proxy || undefined
);
auth.getToken().then((access_token: string) => {
fetcher.setToken(access_token);
});
ipc.on('renderer-ready', () => fetcher.start());
ipc.on('force-update-repos', () => fetcher.doScraping());
ipc.on('tray-icon-normal', () => menu_window.tray.setImage(normal_icon));
ipc.on('tray-icon-notified', () => menu_window.tray.setImage(notified_icon));
ipc.on('start-github-login', () => doLogin(fetcher, menu_window.window.webContents));
if (app_config.hot_key !== '') {
shortcut.register(
app_config.hot_key,
() => menu_window.window.isVisible() ? menu_window.hideWindow() : menu_window.showWindow()
);
}
});
示例7: Ready
private Ready(): void {
// create the browser window.
this.mainWindow = new BrowserWindow({width: 800, height: 800});
this.BuildMenu();
// and load the index.html of the app.
this.mainWindow.loadUrl(this.startURI);
// emitted when the window is closed.
this.mainWindow.on("closed", () => {
// 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.
this.mainWindow = null;
});
ipc.on("copyToClipboard", (event: any, rect: any) => {
this.CopyToClipboard(rect);
}
);
}
示例8: require
// report crashes to the Electron project
require('crash-reporter').start();
// prevent window being GC'd
var mainWindow = null;
var shell = null;
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
ipc.on('platform', function(event, arg) {
event.sender.send('platform', os.platform());
});
ipc.on('load-configuration', function(event, arg) {
userConfig.loadConfiguration().then((config) => {
event.sender.send('user-configuration', config);
});
});
app.on('ready', function () {
mainWindow = new BrowserWindow({
width: 1024,
height: 768,
resizable: true
});