browser-load-script
v1.0.0
Published
Load script in browser.
Downloads
10
Readme
browser-load-script
Load script in browser.
Install
yarn add browser-load-script
Usage
<script type="importmap">
{
"imports": {
"browser-load-script": "https://unpkg.com/browser-load-script"
}
}
</script>
<script type="module">
import loadScript from 'browser-load-script'
await loadScript('data:application/javascript,')
</script>
API
loadScript(sourceOrProperties)
import loadScript from 'browser-load-script'
await loadScript('https://example.com/script.js')
sourceOrProperties
- Type:
string | Object
import loadScript from 'browser-load-script'
await loadScript({
src: 'https://example.com/script.js',
defer: true,
crossOrigin: 'anonymous',
})