src="https://fastly.jsdelivr.net/npm/barcode-detector@2/dist/es/side-effects.min.js"></script>
<script>
let libnemo, css
- const barcodeDetector = new BarcodeDetector({
- formats: ["qr_code"],
- })
- const imageFile = await fetch(
- "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Hello%20world!",
- ).then(resp => resp.blob())
- barcodeDetector.detect(imageFile).then(console.log)
-
- const observer = new MutationObserver((mutations) => {
- for (const mutation of mutations) {
- if (mutation.type === "attributes") {
- mutation.target.dispatchEvent(new Event('attributeschanged'))
- }
- }
- })
window.addEventListener('load', async (event) => {
try {
async function loadNemo () {
console.log('loading libnemo')
libnemo = await import('https://cdn.jsdelivr.net/npm/libnemo@0.0.14/dist/main.min.js')
+ const barcodeDetector = new BarcodeDetector({
+ formats: ["qr_code"],
+ })
+ const imageFile = await fetch(
+ "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Hello%20world!",
+ ).then(resp => resp.blob())
+ barcodeDetector.detect(imageFile).then(console.log)
+
+ const observer = new MutationObserver((mutations) => {
+ for (const mutation of mutations) {
+ if (mutation.type === "attributes") {
+ mutation.target.dispatchEvent(new Event('attributeschanged'))
+ }
+ }
+ })
console.log('loaded libnemo')
}