electron-typescript-ipc
electron-typescript-ipc copied to clipboard
Make the message subscription return an optional unsubscribe callback
Hi, @JichouP , thanks for building this handy package to add TypeScript support for electron IPC. When I was using it, I find there's no way to unsubscribe a message from main. I propose this change to let the on.xxx
function return an optional callback, so that the renderer code can unsubscribe the message channel when it's no longer needed.
I also made a small change in the build scripts, use rimraf
, which is cross platform, to replace the POSIX command rm -rf
. With this change, the package can be built on Windows.
Feel free to comments, and I'll make changes accordingly.
@wewei Thank you for your contribution. It looks good to me!
Did it work correctly without changing the return type here? https://github.com/JichouP/electron-typescript-ipc/blob/bf61ffc/src/index.ts#L19