本文整理匯總了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
});