hadron-ipc
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -1,1 +0,28 @@ | ||
export = any; | ||
import type { IpcMain, IpcRenderer, BrowserWindow } from 'electron'; | ||
export type HadronIpcMain = IpcMain & { | ||
respondTo( | ||
name: string, | ||
handler: (browserWindow: BrowserWindow, ...args: any[]) => any | ||
): void; | ||
respondTo( | ||
handlerMap: Record< | ||
string, | ||
(browserWindow: BrowserWindow, ...args: any[]) => any | ||
> | ||
): void; | ||
broadcast(name: string, ...args: any[]): void; | ||
broadcastFocused(name: string, ...args: any[]): void; | ||
remove: typeof ipcMain['removeListener']; | ||
}; | ||
export type HadronIpcRenderer = IpcRenderer & { | ||
call(name: string, ...args: any[]): Promise<any>; | ||
callQuiet(name: string, ...args: any[]): Promise<any>; | ||
}; | ||
export type HadronIpc = HadronIpcMain | HadronIpcRenderer; | ||
export = HadronIpc; | ||
export const ipcMain: HadronIpcMain; | ||
export const ipcRenderer: HadronIpcRenderer; |
12
index.js
@@ -20,5 +20,13 @@ 'use strict'; | ||
return isRenderer ? require('./lib/renderer') : require('./lib/main'); | ||
const ipc = isRenderer ? require('./lib/renderer') : require('./lib/main'); | ||
module.exports = ipc; | ||
if (isRenderer) { | ||
module.exports.ipcRenderer = ipc; | ||
} else { | ||
module.exports.ipcMain = ipc; | ||
} | ||
} | ||
module.exports = requireExportModule(); | ||
requireExportModule(); |
@@ -6,7 +6,7 @@ 'use strict'; | ||
const ipcRenderer = electron.ipcRenderer; | ||
const debug = require('debug')('hadron-ipc:renderer'); | ||
const _debug = require('debug')('hadron-ipc:renderer'); | ||
exports = ipcRenderer; | ||
exports.call = function(methodName, ...args) { | ||
function call(debug, methodName, ...args) { | ||
debug(`calling ${methodName} with args`, args); | ||
@@ -33,4 +33,12 @@ const responseChannel = getResponseChannel(methodName); | ||
}); | ||
} | ||
exports.callQuiet = function(methodName, ...args) { | ||
return call(() => {}, methodName, ...args); | ||
}; | ||
exports.call = function(methodName, ...args) { | ||
return call(_debug, methodName, ...args); | ||
}; | ||
module.exports = exports; |
{ | ||
"name": "hadron-ipc", | ||
"description": "Simplified IPC for electron apps.", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"scripts": { | ||
@@ -18,4 +18,9 @@ "check": "npm run lint && npm run depcheck", | ||
}, | ||
"main": "index.js", | ||
"exports": { | ||
"webpack": "./index.js", | ||
"require": "./index.js" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.1.1", | ||
"debug": "4.3.0", | ||
"is-electron-renderer": "^2.0.1", | ||
@@ -28,4 +33,4 @@ "is-promise": "^2.1.0", | ||
"depcheck": "^1.4.1", | ||
"electron": "^6.1.12", | ||
"electron-mocha": "^8.2.0", | ||
"electron": "^13.5.1", | ||
"electron-mocha": "^10.1.0", | ||
"eslint": "^7.25.0", | ||
@@ -40,3 +45,3 @@ "eslint-config-mongodb-js": "^5.0.3", | ||
}, | ||
"gitHead": "455c6523f99a08c6796480d59727b53bdfa441f0" | ||
"gitHead": "8ef2cccaaab6d84a5fcd633ea8dfc4c7a4db551f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41043
147
196
+ Addeddebug@4.3.0(transitive)
+ Addedms@2.1.2(transitive)
- Removeddebug@4.3.7(transitive)
- Removedms@2.1.3(transitive)
Updateddebug@4.3.0