The Action Registry
The action registry maintains a registry of functions that can be executed in the main process from a renderer process. Think of actions like a very simple RPC like mechansim.
There is only one action registry and it can always be found at jancy.actionRegistry
.
To call an action from a renderer process via the
ipcRenderer
API the call would look something like this:
ipcRenderer.send('action', { type: 'dispatch', action: 'some-action-id', args: args })
where
args
can be anything that can be serialized with the structured clone algorithm.
Methods
actionRegistry.register(id, func)
id
(string
)func
(function
)
Associates func
with id
and makes it dispatchable.
func
will be called with the following arguments:
args
(any)sender
(webContents
)
actionRegistry.unregister(id)
id
(string
)
Unregisters a previously registered function by id
.