buntralino-client
Version:
Neutralino.js library for Buntralino. Buntralino unites Bun and Neutralino.js to make a simpler, lighter alternative to Electron and NW.js. Use Neutralino.js API at client and send harder tasks to Bun while keeping your development process easy.
54 lines (53 loc) • 1.69 kB
TypeScript
export declare const disableBunCheck: () => void;
/**
* Runs a method registered through registerMethod or registerMethodMap on Bun side.
* Payload can be any JSON serializable value.
* Returns a Promise that resolves with the result of the method or rejects with an Error.
*
* Example:
* ```js
* await buntralino.run('downloadFile', {
* src: 'https://secret.bunnies.io/builds/windows.exe',
* dest: 'dependencies/secretBunnies.exe'
* });
* ```
*/
export declare const run: (methodName: string, payload?: unknown) => Promise<unknown>;
/**
* Fully shuts down the Buntralino app.
*/
export declare const shutdown: () => void;
/**
* Sends an event with additional event.detail value to all the Neutralino instances.
*
* Example:
* ```js
* buntralino.broadcast('newUpdate', {
* version: '1.4.2'
* });
* ```
*/
export declare const broadcast: (eventName: string, payload: unknown) => void;
/**
* Sends an event with additional event.detail value to a specific named Neutralino instance.
*
* Example:
* ```js
* buntralino.sendEvent('main', 'loginSuccessful', {
* username: 'Doofus3000'
* });
* ```
*/
export declare const sendEvent: (target: string, eventName: string, payload?: unknown) => void;
/**
* A Promise that resolves when the Buntralino client is ready to accept commands.
*/
export declare const ready: Promise<void>;
declare const _default: {
run: (methodName: string, payload?: unknown) => Promise<unknown>;
ready: Promise<void>;
shutdown: () => void;
broadcast: (eventName: string, payload: unknown) => void;
sendEvent: (target: string, eventName: string, payload?: unknown) => void;
};
export default _default;