Skip to content

Commit

Permalink
release: 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Hill-98 committed Oct 23, 2024
1 parent 2335957 commit 1b01a96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Focus on IPC implementation without worrying about trivial matters, and you can
* All methods are type-safe.
* Everything is module, with no `window` and `global.d.ts`.
* By default, the [serialize-error](https://www.npmjs.com/package/serialize-error) library is used to serialize error objects, so you don't have to worry about error handling. You can also customize the error handler.
* `global.d.ts` is not required.
* Provide some optional security mechanisms to enhance security.

**Even if you don't use TypeScript, you can use this library, which can help alleviate the burden of using IPC.**

Expand Down Expand Up @@ -42,15 +42,20 @@ type Functions = {
say(who: string): string
}

const controller = new IpcController<Functions>('hello')
export const controller = new IpcController<Functions>('hello')
export const callers = controller.callers // Proxy object
export const handlers = controller.handlers // Proxy object

// preload.ts
import { contextBridge, ipcRenderer } from 'electron/renderer'
import { preloadInit } from 'electron-ipc-flow' // need bundler
import { controller as hello } from './hello.ts'

preloadInit(contextBridge, ipcRenderer)
preloadInit(contextBridge, ipcRenderer, {
autoRegisterIpcController: false, // Optional, default to true.
})
// If `autoRegisterIpcController` is false, the controller needs to be register manually.
hello.register()

// renderer.ts
import { callers as hello } from './hello.ts'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-ipc-flow",
"version": "1.0.0",
"version": "1.0.1",
"description": "Fluently and type-safely write IPC for Electron",
"keywords": [
"electron",
Expand Down

0 comments on commit 1b01a96

Please sign in to comment.