'use strict';

var electron = require('electron');

electron.contextBridge.exposeInMainWorld('openIMRenderApi', {
    subscribe: (channel, callback) => {
        const subscription = (_, ...args) => callback(...args);
        electron.ipcRenderer.on(channel, subscription);
        return () => electron.ipcRenderer.removeListener(channel, subscription);
    },
    imMethodsInvoke: (method, ...args) => electron.ipcRenderer.invoke('openim-sdk-ipc-methods', method, ...args),
});
