Skip to content

Commit

Permalink
fix: always return same connector instance (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e authored Oct 3, 2024
1 parent 1b2424b commit e7a47e5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lock.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import Connector from './connector';

export default class Lock {
public connectors = {};
public connectors: Record<string, Connector> = {};
public options = {};

addConnector(connector: any) {
this.connectors[connector.key] = connector.connector;
this.connectors[connector.key] = new connector.connector(connector.options);
this.options[connector.key] = connector.options;
}

getConnector(key: string): Connector {
const options = this.options[key];
return new this.connectors[key](options);
return this.connectors[key];
}
}

0 comments on commit e7a47e5

Please sign in to comment.