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