diff --git a/dist/index.d.ts b/dist/index.d.ts index 1dc4bc6..2b08c04 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -3,6 +3,7 @@ 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"; +import { EventEmitter2 as EventEmitter } from "eventemitter2"; type callModuleBound = (method: string, data?: any) => Promise; type connectModuleBound = (method: string, data: any, receiveUpdate: DataFn) => [sendUpdate: DataFn, response: Promise]; declare let callModule: callModule; @@ -19,7 +20,7 @@ export interface ModuleBagBound extends ModuleBag { callModule: callModuleBound; connectModule: connectModuleBound; } -export declare abstract class Client { +export declare abstract class Client extends EventEmitter { private _callModule?; get callModule(): callModuleBound; private _connectModule?; diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index f727d89..eb70127 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -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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C,IAAI,UAAU,IAAI,eAAe,CAEhC;IAED,OAAO,CAAC,cAAc,CAAC,CAAqB;IAE5C,IAAI,aAAa,IAAI,kBAAkB,CAEtC;IAEY,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAavC,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"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index d58c6f7..4bf5843 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,8 +1,9 @@ +import { EventEmitter2 as EventEmitter } from "eventemitter2"; let callModule; let connectModule; let log; let logErr; -export class Client { +export class Client extends EventEmitter { _callModule; get callModule() { return this._callModule;