diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..e1e1564 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,3 @@ +{ + "no-trailing-punctuation": false +} \ No newline at end of file diff --git a/example/main.js b/example/main.js index 4bd99bb..0966dff 100644 --- a/example/main.js +++ b/example/main.js @@ -53,24 +53,6 @@ app.whenReady().then(() => { const windowB = createWindow('Window B'); ipcMain.registerBrowserWindow('window-b', windowB); windowB.loadFile('index.html'); - - // Promise.all([promiseA, promiseB, promiseC]).then(() => { - // // All three browser windows are registered for IPC communication at this point - - // ipcMain.send('window-a', 'test-send-from-main', 'Send a message from main'); - // ipcMain.invoke('window-b', 'test-invoke-from-main', 'Square this number', 5) - // .then((result) => { - // console.log(`test-main-invoke: result=${result}`); - // }); - // ipcMain.handle('window-c', 'test-renderer-invoke', (msg, n) => { - // console.log(`test-renderer-invoke: msg=${msg}, n=${n}`); - // return n + 5; - // }); - // ipcMain.on('window-c', 'test-renderer-invoke', (msg, n) => { - // console.log(`test-renderer-invoke: msg=${msg}, n=${n}`); - // return n + 5; - // }); - // }); }); app.on('window-all-closed', () => { diff --git a/package.json b/package.json index 6cd540a..d6bf38c 100644 --- a/package.json +++ b/package.json @@ -4,5 +4,12 @@ "eslint": "^7.10.0", "eslint-config-airbnb-base": "^14.2.0", "eslint-plugin-import": "^2.21.2" - } + }, + "name": "electron-postman", + "version": "0.1.0", + "description": "Easy Electron IPC with focus on window-to-window communication and disabled node integration in renderers", + "main": "index.js", + "repository": "git@github.com:ylieder/electron-postman.git", + "author": "Yannic Lieder", + "license": "MIT" } diff --git a/src/ipcMain.js b/src/ipcMain.js index cfcee72..33f5825 100644 --- a/src/ipcMain.js +++ b/src/ipcMain.js @@ -81,7 +81,7 @@ function once(windowName, channel, callback) { } } -function invoke(windowName, channel, ...args) { +function invokeTo(windowName, channel, ...args) { const token = getToken(); return new Promise((resolve) => { ipcMain.once(prefixed(windowName, channel, token), (event, result) => { @@ -116,7 +116,7 @@ module.exports = { sendTo, on, once, - invoke, + invokeTo, handle, handleOnce, removeAllListeners,