mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00

tabs fix (I fixed network, open tab and other things) travis prerelease Getting rid of the remote module (partially). Still have a lot of work. Updating native modules. partially updating to match version 0.0.308. Still need more changes.
25 lines
650 B
JavaScript
25 lines
650 B
JavaScript
const {Dispatch: DispatchNative} = require('./discord_dispatch_'+process.platform+'.node');
|
|
|
|
let lastState = null;
|
|
|
|
function dispatchConstructor(jsonConfigString, updateCallback, errorCallback, analyticsCallback) {
|
|
const instance = new DispatchNative(
|
|
jsonConfigString,
|
|
(state) => {
|
|
lastState = JSON.parse(state);
|
|
updateCallback(state);
|
|
},
|
|
errorCallback,
|
|
analyticsCallback
|
|
);
|
|
return {
|
|
command: instance.command.bind(instance),
|
|
destroy: (...args) => {
|
|
instance.destroy(...args);
|
|
lastState = null;
|
|
},
|
|
};
|
|
}
|
|
|
|
module.exports = {Dispatch: dispatchConstructor, getLastState: () => lastState};
|