Skip to content

Commit

Permalink
Avoid error on duplicate define calls
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienGllmt committed Oct 7, 2023
1 parent 054b66b commit 341ac73
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,27 @@ import {PeraWalletSignTxnModal} from "./modal/sign-txn/PeraWalletSignTxnModal";

import "./util/screen/setDynamicVhValue";

window.customElements.define("pera-wallet-connect-modal", PeraWalletConnectModal);
window.customElements.define(
"pera-wallet-modal-desktop-mode",
PeraWalletModalDesktopMode
);
window.customElements.define("pera-wallet-modal-header", PeraWalletModalHeader);
window.customElements.define(
function defineCustomElement(name: string, element: CustomElementConstructor) {
if (!customElements.get(name)) {
customElements.define(name, element);
}
}
defineCustomElement("pera-wallet-connect-modal", PeraWalletConnectModal);
defineCustomElement("pera-wallet-modal-desktop-mode", PeraWalletModalDesktopMode);
defineCustomElement("pera-wallet-modal-header", PeraWalletModalHeader);
defineCustomElement(
"pera-wallet-modal-touch-screen-mode",
PeraWalletModalTouchScreenMode
);
window.customElements.define("pera-wallet-redirect-modal", PeraWalletRedirectModal);
window.customElements.define(
defineCustomElement("pera-wallet-redirect-modal", PeraWalletRedirectModal);
defineCustomElement(
"pera-wallet-connect-modal-information-section",
PeraWalletConnectModalInformationSection
);
window.customElements.define(
defineCustomElement(
"pera-wallet-connect-modal-pending-message-section",
PeraWalletConnectModalPendingMessageSection
);
window.customElements.define("pera-wallet-sign-txn-toast", PeraWalletSignTxnToast);
window.customElements.define("pera-wallet-sign-txn-modal", PeraWalletSignTxnModal);
window.customElements.define("pera-wallet-download-qr-code", PeraWalletDownloadQRCode);
defineCustomElement("pera-wallet-sign-txn-toast", PeraWalletSignTxnToast);
defineCustomElement("pera-wallet-sign-txn-modal", PeraWalletSignTxnModal);
defineCustomElement("pera-wallet-download-qr-code", PeraWalletDownloadQRCode);

0 comments on commit 341ac73

Please sign in to comment.