From e7a47e5940f30562466b38db432036c93ee5c6df Mon Sep 17 00:00:00 2001 From: Wan <495709+wa0x6e@users.noreply.github.com> Date: Fri, 4 Oct 2024 04:45:30 +0900 Subject: [PATCH] fix: always return same connector instance (#118) --- src/lock.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lock.ts b/src/lock.ts index 404cf13..0f5e075 100644 --- a/src/lock.ts +++ b/src/lock.ts @@ -1,16 +1,15 @@ import Connector from './connector'; export default class Lock { - public connectors = {}; + public connectors: Record = {}; 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]; } }