本文整理汇总了TypeScript中electron.ipcRenderer类的典型用法代码示例。如果您正苦于以下问题:TypeScript ipcRenderer类的具体用法?TypeScript ipcRenderer怎么用?TypeScript ipcRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ipcRenderer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: attachTo
function attachTo(item: ProcessItem) {
const config: any = {
type: 'node',
request: 'attach',
name: `process ${item.pid}`
};
let matches = DEBUG_FLAGS_PATTERN.exec(item.cmd);
if (matches && matches.length >= 2) {
// attach via port
if (matches.length === 4 && matches[3]) {
config.port = parseInt(matches[3]);
}
config.protocol = matches[1] === 'debug' ? 'legacy' : 'inspector';
} else {
// no port -> try to attach via pid (send SIGUSR1)
config.processId = String(item.pid);
}
// a debug-port=n or inspect-port=n overrides the port
matches = DEBUG_PORT_PATTERN.exec(item.cmd);
if (matches && matches.length === 3) {
// override port
config.port = parseInt(matches[2]);
}
ipcRenderer.send('vscode:workbenchCommand', { id: 'debug.startFromConfig', from: 'processExplorer', args: [config] });
}
示例2: getSelectedClients
this.$['save-btn'].addEventListener('click', () => {
const clients = getSelectedClients(grid)
if (clients.length) {
const opts = {}
ipcRenderer.send('invoice-save', clients, this.getInvoiceData(), opts)
}
})
示例3: okay
function okay(){
ipcRenderer.send('color-okay', {
gameObjectId: gameObjectId,
componentId: componentId,
propertyName: propertyName,
hexColor: selectedColor.hex
});
}
示例4: next
export const backendMiddleware: Middleware = <AppState>(store: MiddlewareAPI<AppState>) => (next: Dispatch<AppState>) => (originalAction: any) => {
const result = next(originalAction);
const action: AppAction = originalAction as any;
ipcRenderer.send('action', [store.getState(), action]);
return result
}
示例5: navigatePaymentUrl
function navigatePaymentUrl(payload: string) {
const settings = getSettings();
Electron.ipcRenderer.send("createCheckoutWindow", {
payload: payload,
settings: settings,
serviceUrl: Emulator.serviceUrl
});
}
示例6: okay
function okay(value: string) {
ipcRenderer.send('selector-okay', {
gameObjectId: gameObjectId,
componentId: componentId,
propertyName: propertyName,
value: value
});
}
示例7:
(e: any, webContentsId: number) => {
let sent = false;
for (const page of store.pagesStore.pages) {
if (
page.webview.getWebContents() &&
page.webview.getWebContents().id === webContentsId
) {
const tab = store.tabsStore.getTabById(page.id).getApiTab();
ipcRenderer.send('get-tab-by-web-contents-id', tab);
sent = true;
break;
}
}
if (!sent) {
ipcRenderer.send('get-tab-by-web-contents-id', {});
}
},
示例8: getUser
getUser(user:User) {
ipcRenderer.send('getUser', user)
return new Promise<User>((resolve, reject) => {
ipcRenderer.once('user-reply', (event, arg) => {
resolve(arg);
});
});
}
示例9: navigateOAuthUrl
function navigateOAuthUrl(url: string) {
const settings = getSettings();
Electron.ipcRenderer.send("createOAuthWindow", {
url: url,
settings: settings,
serviceUrl: Emulator.serviceUrl
});
}
示例10: constructor
constructor(private readonly config: Config) {
this.switchTo(this.getFirstScreenName());
// After hiding window, <webview> loses its focus.
// So when window is shown again, need to give <webview> focus again.
// Note:
// remove.getCurrentWindow().on('focus', ...) is unavailable
// because callback remains after this web contents reloaded.
// Remained callback causes a 'trying to send message to removed web contents'
// error.
ipc.on('tuitter:window-focused', () => this.wv.focus());
ipc.on('tuitter:menu:new-tweet', () => this.wv.sendIpc('tuitter:new-tweet'));
ipc.on('tuitter:will-suspend', (__: any, threshold: number) => {
log.debug('Refresh app because system will be suspended. Threshold:', threshold, this.wv);
this.wv.sendIpc('tuitter:will-suspend', threshold);
});
}