This repository has been archived on 2023-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
libkernel-universal/dist/index.d.ts

42 lines
1.7 KiB
TypeScript
Raw Normal View History

2023-01-31 10:02:52 +00:00
type callModule = typeof import("libkmodule").callModule;
type connectModule = typeof import("libkmodule").connectModule;
type logErr = typeof import("libkmodule").logErr;
type log = typeof import("libkmodule").log;
import type { ErrTuple, DataFn } from "@siaweb/libweb";
2023-02-05 15:26:29 +00:00
import EventEmitter from "eventemitter3";
2023-01-31 10:02:52 +00:00
type callModuleBound = (method: string, data?: any) => Promise<ErrTuple>;
type connectModuleBound = (method: string, data: any, receiveUpdate: DataFn) => [sendUpdate: DataFn, response: Promise<ErrTuple>];
declare let callModule: callModule;
declare let connectModule: connectModule;
declare let log: log;
declare let logErr: logErr;
export interface ModuleBag {
callModule: callModule;
connectModule: connectModule;
log: log;
logErr: logErr;
}
export interface ModuleBagBound extends ModuleBag {
callModule: callModuleBound;
connectModule: connectModuleBound;
}
2023-02-01 12:42:32 +00:00
export declare abstract class Client extends EventEmitter {
2023-01-31 10:02:52 +00:00
private _callModule?;
get callModule(): callModuleBound;
2023-02-17 02:06:32 +00:00
private _log?;
get log(): log;
private _logErr?;
get logErr(): logErr;
2023-01-31 10:02:52 +00:00
private _connectModule?;
get connectModule(): connectModuleBound;
loadLibs(module: string): Promise<void>;
loadBound(module: string): Promise<ModuleBagBound>;
protected handleError(ret: ErrTuple): void;
2023-02-01 12:27:20 +00:00
protected handleErrorOrReturn(ret: ErrTuple): any;
2023-01-31 10:02:52 +00:00
protected callModuleReturn(method: string, data?: any): Promise<any>;
}
export declare function load(module?: string): Promise<ModuleBag | ModuleBagBound>;
type ClientConstructor<U> = new (...args: any[]) => U;
export declare const factory: <T extends Client = Client>(type: ClientConstructor<T>, module: string) => (...args: any) => T;
export {};
//# sourceMappingURL=index.d.ts.map