Skip to content

Commit dd97a52

Browse files
use authprovider itself for weakmap
1 parent ff36a31 commit dd97a52

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/AuthProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function preloadIframe() {
2626
const authServiceIframeMap: WeakMap<object, HTMLIFrameElement> = new WeakMap();
2727

2828
const iframeCleanupRegistry = new FinalizationRegistry((heldValue: HTMLIFrameElement) => {
29-
log.info("Cleaning up iframe");
29+
log.info("Cleaning up iframe", heldValue);
3030

3131
// Remove iframe from DOM
3232
if (heldValue && heldValue.parentNode) {
@@ -62,12 +62,12 @@ export class AuthProvider {
6262
}
6363

6464
getAuthServiceIframe(): HTMLIFrameElement {
65-
return authServiceIframeMap.get(this.embedNonce) as HTMLIFrameElement;
65+
return authServiceIframeMap.get(this) as HTMLIFrameElement;
6666
}
6767

6868
registerAuthServiceIframe(iframe: HTMLIFrameElement) {
69-
authServiceIframeMap.set(this.embedNonce, iframe);
70-
iframeCleanupRegistry.register(this.embedNonce, iframe);
69+
authServiceIframeMap.set(this, iframe);
70+
iframeCleanupRegistry.register(this, iframe);
7171
}
7272

7373
async init({ network, clientId }: { network: WEB3AUTH_NETWORK_TYPE; clientId: string }): Promise<void> {

0 commit comments

Comments
 (0)