Compare commits
2 Commits
fb377db59f
...
952630c546
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 952630c546 | |
Derrick Hammer | f3fb8b490b |
|
@ -27,6 +27,7 @@ export declare abstract class Client {
|
||||||
loadLibs(module: string): Promise<void>;
|
loadLibs(module: string): Promise<void>;
|
||||||
loadBound(module: string): Promise<ModuleBagBound>;
|
loadBound(module: string): Promise<ModuleBagBound>;
|
||||||
protected handleError(ret: ErrTuple): void;
|
protected handleError(ret: ErrTuple): void;
|
||||||
|
protected handleErrorOrReturn(ret: ErrTuple): any;
|
||||||
protected callModuleReturn(method: string, data?: any): Promise<any>;
|
protected callModuleReturn(method: string, data?: any): Promise<any>;
|
||||||
}
|
}
|
||||||
export declare function load(module?: string): Promise<ModuleBag | ModuleBagBound>;
|
export declare function load(module?: string): Promise<ModuleBag | ModuleBagBound>;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,cAAc,YAAY,EAAE,UAAU,CAAC;AACzD,KAAK,aAAa,GAAG,cAAc,YAAY,EAAE,aAAa,CAAC;AAC/D,KAAK,MAAM,GAAG,cAAc,YAAY,EAAE,MAAM,CAAC;AACjD,KAAK,GAAG,GAAG,cAAc,YAAY,EAAE,GAAG,CAAC;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEvD,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AACzE,KAAK,kBAAkB,GAAG,CACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,EACT,aAAa,EAAE,MAAM,KAClB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEvD,QAAA,IAAI,U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avC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAI/D,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAK1C,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,QAAQ,GAAG,GAAG;cAIjC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAK3E;AAED,wBAAsB,IAAI,CACxB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,GAAG,cAAc,CAAC,CA+BrC;AAED,KAAK,iBAAiB,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAEtD,eAAO,MAAM,OAAO,kEAEV,MAAM,eAEY,GAAG,MAiB9B,CAAC"}
|
|
@ -18,8 +18,7 @@ export class Client {
|
||||||
const moduleBag = await this.loadBound(module);
|
const moduleBag = await this.loadBound(module);
|
||||||
this._callModule = async (...args) => {
|
this._callModule = async (...args) => {
|
||||||
const ret = await moduleBag.callModule(...args);
|
const ret = await moduleBag.callModule(...args);
|
||||||
this.handleError(ret);
|
return this.handleErrorOrReturn(ret);
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
this._connectModule = moduleBag.connectModule;
|
this._connectModule = moduleBag.connectModule;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +30,10 @@ export class Client {
|
||||||
throw new Error(ret[1]);
|
throw new Error(ret[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
handleErrorOrReturn(ret) {
|
||||||
|
this.handleError(ret);
|
||||||
|
return ret[0];
|
||||||
|
}
|
||||||
async callModuleReturn(method, data) {
|
async callModuleReturn(method, data) {
|
||||||
const ret = await this.callModule(method, data);
|
const ret = await this.callModule(method, data);
|
||||||
return ret[0];
|
return ret[0];
|
||||||
|
|
|
@ -50,9 +50,7 @@ export abstract class Client {
|
||||||
const moduleBag = await this.loadBound(module);
|
const moduleBag = await this.loadBound(module);
|
||||||
this._callModule = async (...args) => {
|
this._callModule = async (...args) => {
|
||||||
const ret = await moduleBag.callModule(...args);
|
const ret = await moduleBag.callModule(...args);
|
||||||
this.handleError(ret);
|
return this.handleErrorOrReturn(ret);
|
||||||
|
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
this._connectModule = moduleBag.connectModule;
|
this._connectModule = moduleBag.connectModule;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +64,10 @@ export abstract class Client {
|
||||||
throw new Error(ret[1]);
|
throw new Error(ret[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected handleErrorOrReturn(ret: ErrTuple): any {
|
||||||
|
this.handleError(ret);
|
||||||
|
return ret[0];
|
||||||
|
}
|
||||||
protected async callModuleReturn(method: string, data?: any): Promise<any> {
|
protected async callModuleReturn(method: string, data?: any): Promise<any> {
|
||||||
const ret = await this.callModule(method, data);
|
const ret = await this.callModule(method, data);
|
||||||
|
|
||||||
|
|
Reference in New Issue