Last active
May 24, 2021 01:28
-
-
Save wewindy/098f967b88540552cf8428c961024b59 to your computer and use it in GitHub Desktop.
localForage-demo
This file contains 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
import localForage from 'localforage' | |
// 创建仓库对象,并创建名为 “test” 的 indexeddb 以及 名为 “testidb” 的表 | |
const store = localForage.createInstance({ | |
driver: localForage.INDEXEDDB, | |
name: "test", | |
storeName: "testidb" | |
}) | |
// 设置 key-value | |
store.setItem("t1", new Float32Array([113.24, 44.55, 12.512])) | |
// 5 秒后删除 “test” 数据库的 “testidb” 这个表 | |
setTimeout(() => { | |
localForage.dropInstance({ | |
name: "test", | |
storeName: "testidb" | |
}) | |
}, 5000) |
Author
wewindy
commented
Apr 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment