Skip to content

Commit

Permalink
Enable returning the instance directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Aug 17, 2023
1 parent 1dee463 commit 3222bfd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ let apiFactory = null;

class ApiFactory {
constructor(options, overrideLogger = null) {
if (!apiFactory) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
apiFactory = this;
}
// eslint-disable-next-line @typescript-eslint/no-this-alias
apiFactory = this;

this.Authorizer = null;
this.requestMiddleware = options && options.requestMiddleware || (r => r);
this.responseMiddleware = options && options.responseMiddleware || ((_, r) => r);
Expand Down Expand Up @@ -241,4 +240,8 @@ class ApiFactory {
}
}

ApiFactory.getInstance = function getInstance() {
return apiFactory;
};

module.exports = ApiFactory;

0 comments on commit 3222bfd

Please sign in to comment.