mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
17 lines
615 B
TypeScript
17 lines
615 B
TypeScript
import {ipcRenderer} from 'electron';
|
|
import * as remote from '@electron/remote';
|
|
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
|
|
|
|
const plugins = remote.require('./plugins') as typeof import('../../app/plugins');
|
|
|
|
export function getConfig() {
|
|
return plugins.getDecoratedConfig();
|
|
}
|
|
|
|
export function subscribe(fn: (event: Electron.IpcRendererEvent, ...args: any[]) => void) {
|
|
ipcRenderer.on('config change', fn);
|
|
ipcRenderer.on('plugins change', fn);
|
|
return () => {
|
|
ipcRenderer.removeListener('config change', fn);
|
|
};
|
|
}
|