fix: add factory back in
This commit is contained in:
parent
021fcf424e
commit
480fdf23e8
|
@ -61,3 +61,14 @@ export abstract class Client extends EventEmitter {
|
|||
return ret[0];
|
||||
}
|
||||
}
|
||||
|
||||
type ClientConstructor<U> = new (module: string, ...args: any[]) => U;
|
||||
|
||||
export const factory = function <T extends Client = Client>(
|
||||
type: ClientConstructor<T>,
|
||||
module: string,
|
||||
) {
|
||||
return function (...args: any): T {
|
||||
return new type(module, ...args);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,4 +3,4 @@ export { ActiveQuery, addHandler, handleMessage } from "./messages.js";
|
|||
export { callModule, connectModule, newKernelQuery } from "./queries.js";
|
||||
export { getDataFromKernel, getKey } from "./key.js";
|
||||
export { moduleQuery, presentKeyData } from "./types.js";
|
||||
export { Client } from "./client.js";
|
||||
export { Client, factory } from "./client.js";
|
||||
|
|
Loading…
Reference in New Issue