Last active
December 31, 2025 04:34
-
-
Save mike-clark-8192/359b8bddbdcb87bf4382da76720db0b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async function() { | |
| const [fileHandle] = await window.showOpenFilePicker({ | |
| types: [{ | |
| description: 'JavaScript files', | |
| accept: {'text/javascript': ['.js']} | |
| }] | |
| }); | |
| const file = await fileHandle.getFile(); | |
| const contents = await file.text(); | |
| console.log('Loaded:', file.name, contents.length, 'chars'); | |
| // Blob URL | |
| const blob = new Blob([contents], {type: 'application/javascript'}); | |
| const url = URL.createObjectURL(blob); | |
| const script = document.createElement('script'); | |
| script.src = url; | |
| script.onload = () => { | |
| URL.revokeObjectURL(url); | |
| console.log('✓ Loaded via blob URL'); | |
| }; | |
| script.onerror = () => { | |
| URL.revokeObjectURL(url); | |
| console.error('✗ Blob URL failed'); | |
| }; | |
| document.head.appendChild(script); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment