]> zoso.dev Git - nemo-wallet.git/commitdiff
Load buffer polyfill during page initialization.
authorChris Duncan <chris@zoso.dev>
Sat, 2 Nov 2024 06:13:14 +0000 (23:13 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 2 Nov 2024 06:13:14 +0000 (23:13 -0700)
nemo-wallet.html

index f50bff6965ab9531904fdadb5fcd389dfe597a77..c1ecc4417f029d3ca86ca7c728162e06a8769c28 100644 (file)
@@ -4,10 +4,8 @@
        <meta charset="utf-8" />
        <meta lang="en" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
-       <!-- <script type="module" src="https://cdn.jsdelivr.net/npm/barcode-detector@2.2.11/dist/es/side-effects.min.js"></script> -->
-       <script type="module" src="https://cdn.jsdelivr.net/npm/libnemo@0.0.16/dist/global.min.js"></script>
-       <script type="module" src="./test.js"></script>
-       <script type="module" src="../libnemo/dist/global.min.js"></script>
+       <script type="module" src="https://cdn.jsdelivr.net/npm/barcode-detector@2.2.11/dist/es/side-effects.min.js"></script>
+       <script type="module" src="https://cdn.jsdelivr.net/npm/libnemo@0.0.17/dist/global.min.js"></script>
        <script>
                // const barcodeDetector = new BarcodeDetector({
                //      formats: ["qr_code"],
                        } catch (err) {
                                location.hash = '#transact'
                        }
+                       await loadDependencies()
                        await loadData()
                        await loadUi()
                        console.log('done')
                })
 
+               async function loadDependencies () {
+                       console.log('loading dependencies')
+                       globalThis.Buffer ??= (await import('https://cdn.jsdelivr.net/npm/buffer-esm@1.2.0/esm/index.js')).Buffer
+                       console.log('loaded dependencies')
+               }
+
                async function loadData () {
                        console.log('loading data')
                        const walletSelect = document.querySelector('#wallet')