Skip to content

Commit

Permalink
Load Albatross in the iframe “list” method
Browse files Browse the repository at this point in the history
  • Loading branch information
mraveux committed Nov 23, 2024
1 parent 6b2cef5 commit c4db744
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions public/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="noindex">
<title>Nimiq Hub IFrame</title>
<script type="module">
import init, * as Nimiq from '/albatross-client/web/index.js';

/** @type {Promise<Nimiq> | undefined} */
let initPromise;

window.loadAlbatross = async function() {
return initPromise || (initPromise = new Promise(async resolve => {
await init();
resolve(Nimiq);
}));
}
</script>
</head>
<body>
<noscript>
Expand Down
2 changes: 2 additions & 0 deletions src/iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class IFrameApi {
}

public static async list(): Promise<Account[]> {
window.Nimiq = await window.loadAlbatross();

let wallets: WalletInfoEntry[];
if (BrowserDetection.isIOS() || BrowserDetection.isSafari()) {
/*
Expand Down

0 comments on commit c4db744

Please sign in to comment.