Open erjonify opened 11 months ago
Needs to be removed (and the end of it as well)
The script tag must be changed to have the type="module"
We can remove all of this:
<script src="https://cdn.jsdelivr.net/npm/web-streams-polyfill@2.0.2/dist/ponyfill.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/streamsaver@2.0.3/StreamSaver.min.js"></script>
<script>
import streamSaver from 'streamsaver'
const streamSaver = require('streamsaver')
const streamSaver = window.streamSaver
</script>
and replace it with:
<script type="importmap">
{
"imports": {
"streamsaver/StreamSaver.js": "https://cdn.jsdelivr.net/npm/streamsaver@3/StreamSaver.min.js"
}
}
</script>
<script type="module">
// either one works fine, the later one requires importmaps or a web bundler.
import streamSaver from 'https://cdn.jsdelivr.net/npm/streamsaver@3/StreamSaver.min.js'
import streamSaver from 'streamsaver/StreamSaver.min.js'
const uInt8 = new TextEncoder().encode('StreamSaver is awesome')
...
</script>
Every green browser now days have good support for web streams, so i think we can remove the hole shebang where we mention any use of custom stream polyfill
// StreamSaver can detect and use the Ponyfill that is loaded from the cdn.
streamSaver.WritableStream = streamSaver.WritableStream
streamSaver.TransformStream = streamSaver.TransformStream
also the code examples in https://github.com/jimmywarting/StreamSaver.js/tree/master/examples needs to be changed to also have type="module"
in their script tags
Just realized that you created PR #333 (3 threes, 1/3 of 999, threes as in the same length as the amount of number there are in 333) it's also 3:33pm here. and 3 days since you created your first/last commit in this PR! coincident? I think not! 3 is a magic number ✨
- type="module"
@jimmywarting , i did some small changes, feel free to complete the rest :)
closes #185