Skip to content

v1.8.0

Compare
Choose a tag to compare
@BuptStEve BuptStEve released this 03 Jul 08:40
· 3 commits to master since this release
b3f6635

Now you can use ESM in browser, see this demo

<!-- unpkg -->
<script type="module">
    import TuaStorage from 'https://unpkg.com/tua-storage/dist/tua-storage.esm.browser.js'

    const tuaStorage = new TuaStorage({
        storageEngine: localStorage,
    })

    tuaStorage
        .load({
            key: 'test',
            syncFn: () => Promise.resolve('test data'),
        })
        .then(console.log)
        .catch(console.error)
</script>

<!-- jsdelivr -->
<script type="module">
    import TuaStorage from 'https://cdn.jsdelivr.net/npm/tua-storage/dist/tua-storage.esm.browser.js'

    const tuaStorage = new TuaStorage({
        storageEngine: localStorage,
    })

    tuaStorage
        .load({
            key: 'test',
            syncFn: () => Promise.resolve('test data'),
        })
        .then(console.log)
        .catch(console.error)
</script>

Bug Fixes

  • fix: avoid sending request twice, avoid using key as cacheData

Enhancements

  • feat: esm in browser (#29)