UNPKG

@quirks/core

Version:
2 lines (1 loc) 906 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index2.cjs"),s=require("./index8.cjs"),i=require("./index7.cjs");class n extends t.Wallet{constructor(e){super(e),this.init(),this.keystoreChange=this.keystoreChange.bind(this)}keystoreChange(){this.events.emit("keystorechange")}removeListeners(){super.removeListeners(),typeof window<"u"&&this.options.events&&window.removeEventListener(this.options.events.keystorechange,this.keystoreChange)}addListeners(){this.removeListeners(),typeof window<"u"&&this.options.events&&window.addEventListener(this.options.events.keystorechange,this.keystoreChange)}async init(){s.assertIsDefined(this.options.windowKey);try{return this.client=await i.getClientFromExtension(this.options.windowKey),this.injected=!0,this.client&&this.addListeners(),this.client}catch(e){this.injectionError=e}}}exports.ExtensionWallet=n;