[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2958":3},{"id":4,"name":5,"fullName":6,"owner":5,"repo":5,"description":7,"homepage":8,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":16,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":22,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":15,"starSnapshotCount":15,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},2958,"localForage","localForage\u002FlocalForage","💾 Offline storage, improved. Wraps IndexedDB, WebSQL, or localStorage using a simple but powerful API.","https:\u002F\u002Flocalforage.github.io\u002FlocalForage",null,"JavaScript",25781,1294,302,215,0,1,11,44.34,"Apache License 2.0",false,"master",true,[24,25,26,27,28,29,30],"indexeddb","javascript","localforage","localstorage","offline","storage","websql","2026-06-12 02:00:45","# localForage\n[![NPM version](https:\u002F\u002Fbadge.fury.io\u002Fjs\u002Flocalforage.svg)](http:\u002F\u002Fbadge.fury.io\u002Fjs\u002Flocalforage)\n[![npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdm\u002Flocalforage.svg?maxAge=2592000)](https:\u002F\u002Fnpmcharts.com\u002Fcompare\u002Flocalforage?minimal=true)\n[![jsDelivr Hits](https:\u002F\u002Fdata.jsdelivr.com\u002Fv1\u002Fpackage\u002Fnpm\u002Flocalforage\u002Fbadge?style=rounded)](https:\u002F\u002Fwww.jsdelivr.com\u002Fpackage\u002Fnpm\u002Flocalforage)\n[![minzipped size](https:\u002F\u002Fbadgen.net\u002Fbundlephobia\u002Fminzip\u002Flocalforage)](https:\u002F\u002Fbundlephobia.com\u002Fresult?p=localforage@1.10.0)\n\nlocalForage is a fast and simple storage library for JavaScript. localForage\nimproves the offline experience of your web app by using asynchronous storage\n(IndexedDB or WebSQL) with a simple, `localStorage`-like API.\n\nlocalForage uses localStorage in browsers with no IndexedDB or\nWebSQL support. See [the wiki for detailed compatibility info][supported browsers].\n\nTo use localForage, just drop a single JavaScript file into your page:\n\n```html\n\u003Cscript src=\"localforage\u002Fdist\u002Flocalforage.js\">\u003C\u002Fscript>\n\u003Cscript>localforage.getItem('something', myCallback);\u003C\u002Fscript>\n```\nTry the [live example](http:\u002F\u002Fcodepen.io\u002Fthgreasi\u002Fpen\u002FojYKeE).\n\nDownload the [latest localForage from GitHub](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Freleases\u002Flatest), or install with\n[npm](https:\u002F\u002Fwww.npmjs.com\u002F):\n\n```bash\nnpm install localforage\n```\n\n[supported browsers]: https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Fwiki\u002FSupported-Browsers-Platforms\n\n## Support\n\nLost? Need help? Try the\n[localForage API documentation](https:\u002F\u002Flocalforage.github.io\u002FlocalForage). [localForage API文档也有中文版。](https:\u002F\u002Flocalforage.docschina.org)\n\nIf you're having trouble using the library, running the tests, or want to contribute to localForage, please look through the [existing issues](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Fissues) for your problem first before creating a new one. If you still need help, [feel free to file an issue](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Fissues\u002Fnew).\n\n# How to use localForage\n\n## Callbacks vs Promises\n\nBecause localForage uses async storage, it has an async API.\nIt's otherwise exactly the same as the\n[localStorage API](https:\u002F\u002Fhacks.mozilla.org\u002F2009\u002F06\u002Flocalstorage\u002F).\n\nlocalForage has a dual API that allows you to either use Node-style callbacks\nor [Promises](https:\u002F\u002Fwww.promisejs.org\u002F). If you are unsure which one is right for you, it's recommended to use Promises.\n\nHere's an example of the Node-style callback form:\n\n```js\nlocalforage.setItem('key', 'value', function (err) {\n  \u002F\u002F if err is non-null, we got an error\n  localforage.getItem('key', function (err, value) {\n    \u002F\u002F if err is non-null, we got an error. otherwise, value is the value\n  });\n});\n```\n\nAnd the Promise form:\n\n```js\nlocalforage.setItem('key', 'value').then(function () {\n  return localforage.getItem('key');\n}).then(function (value) {\n  \u002F\u002F we got our value\n}).catch(function (err) {\n  \u002F\u002F we got an error\n});\n```\n\nOr, use `async`\u002F`await`:\n\n```js\ntry {\n    const value = await localforage.getItem('somekey');\n    \u002F\u002F This code runs once the value has been loaded\n    \u002F\u002F from the offline store.\n    console.log(value);\n} catch (err) {\n    \u002F\u002F This code runs if there were any errors.\n    console.log(err);\n}\n```\n\nFor more examples, please visit [the API docs](https:\u002F\u002Flocalforage.github.io\u002FlocalForage).\n\n## Storing Blobs, TypedArrays, and other JS objects\n\nYou can store any type in localForage; you aren't limited to strings like in\nlocalStorage. Even if localStorage is your storage backend, localForage\nautomatically does `JSON.parse()` and `JSON.stringify()` when getting\u002Fsetting\nvalues.\n\nlocalForage supports storing all native JS objects that can be serialized to\nJSON, as well as ArrayBuffers, Blobs, and TypedArrays. Check the\n[API docs][api] for a full list of types supported by localForage.\n\nAll types are supported in every storage backend, though storage limits in\nlocalStorage make storing many large Blobs impossible.\n\n[api]: https:\u002F\u002Flocalforage.github.io\u002FlocalForage\u002F#data-api-setitem\n\n## Configuration\n\nYou can set database information with the `config()` method.\nAvailable options are `driver`, `name`, `storeName`, `version`, `size`, and\n`description`.\n\nExample:\n```javascript\nlocalforage.config({\n    driver      : localforage.WEBSQL, \u002F\u002F Force WebSQL; same as using setDriver()\n    name        : 'myApp',\n    version     : 1.0,\n    size        : 4980736, \u002F\u002F Size of database, in bytes. WebSQL-only for now.\n    storeName   : 'keyvaluepairs', \u002F\u002F Should be alphanumeric, with underscores.\n    description : 'some description'\n});\n```\n\n**Note:** you must call `config()` _before_ you interact with your data. This\nmeans calling `config()` before using `getItem()`, `setItem()`, `removeItem()`,\n`clear()`, `key()`, `keys()` or `length()`.\n\n## Multiple instances\n\nYou can create multiple instances of localForage that point to different stores\nusing `createInstance`. All the configuration options used by\n[`config`](#configuration) are supported.\n\n``` javascript\nvar store = localforage.createInstance({\n  name: \"nameHere\"\n});\n\nvar otherStore = localforage.createInstance({\n  name: \"otherName\"\n});\n\n\u002F\u002F Setting the key on one of these doesn't affect the other.\nstore.setItem(\"key\", \"value\");\notherStore.setItem(\"key\", \"value2\");\n```\n\n## RequireJS\n\nYou can use localForage with [RequireJS](http:\u002F\u002Frequirejs.org\u002F):\n\n```javascript\ndefine(['localforage'], function(localforage) {\n    \u002F\u002F As a callback:\n    localforage.setItem('mykey', 'myvalue', console.log);\n\n    \u002F\u002F With a Promise:\n    localforage.setItem('mykey', 'myvalue').then(console.log);\n});\n```\n\n## TypeScript\n\nIf you have the [`allowSyntheticDefaultImports` compiler option](https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002Fcompiler-options.html) set to `true` in your [tsconfig.json](https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002Ftsconfig-json.html) (supported in TypeScript v1.8+), you should use:\n\n```javascript\nimport localForage from \"localforage\";\n```\n\nOtherwise you should use one of the following:\n\n```javascript\nimport * as localForage from \"localforage\";\n\u002F\u002F or, in case that the typescript version that you are using\n\u002F\u002F doesn't support ES6 style imports for UMD modules like localForage\nimport localForage = require(\"localforage\");\n```\n\n## Framework Support\n\nIf you use a framework listed, there's a localForage storage driver for the\nmodels in your framework so you can store data offline with localForage. We\nhave drivers for the following frameworks:\n\n* [AngularJS](https:\u002F\u002Fgithub.com\u002Focombe\u002Fangular-localForage)\n* [Angular 4 and up](https:\u002F\u002Fgithub.com\u002FAlorel\u002Fngforage\u002F)\n* [Backbone](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage-backbone)\n* [Ember](https:\u002F\u002Fgithub.com\u002Fgenkgo\u002Fember-localforage-adapter)\n* [Vue](https:\u002F\u002Fgithub.com\u002Fdmlzj\u002Fvlf)\n* [NuxtJS](https:\u002F\u002Fgithub.com\u002Fnuxt-community\u002Flocalforage-module)\n\nIf you have a driver you'd like listed, please\n[open an issue](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Fissues\u002Fnew) to have it\nadded to this list.\n\n## Custom Drivers\n\nYou can create your own driver if you want; see the\n[`defineDriver`](https:\u002F\u002Flocalforage.github.io\u002FlocalForage\u002F#driver-api-definedriver) API docs.\n\nThere is a [list of custom drivers on the wiki][custom drivers].\n\n[custom drivers]: https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Fwiki\u002FCustom-Drivers\n\n# Working on localForage\n\nYou'll need [node\u002Fnpm](http:\u002F\u002Fnodejs.org\u002F) and\n[bower](http:\u002F\u002Fbower.io\u002F#installing-bower).\n\nTo work on localForage, you should start by\n[forking it](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Ffork) and installing its\ndependencies. Replace `USERNAME` with your GitHub username and run the\nfollowing:\n\n```bash\n# Install bower globally if you don't have it:\nnpm install -g bower\n\n# Replace USERNAME with your GitHub username:\ngit clone git@github.com:USERNAME\u002FlocalForage.git\ncd localForage\nnpm install\nbower install\n```\n\nOmitting the bower dependencies will cause the tests to fail!\n\n## Running Tests\n\nYou need PhantomJS installed to run local tests. Run `npm test` (or,\ndirectly: `grunt test`). Your code must also pass the\n[linter](http:\u002F\u002Fjshint.com\u002F).\n\nlocalForage is designed to run in the browser, so the tests explicitly require\na browser environment. Local tests are run on a headless WebKit (using\n[PhantomJS](http:\u002F\u002Fphantomjs.org)).\n\nWhen you submit a pull request, tests will be run against all browsers that\nlocalForage supports on Travis CI using [Sauce Labs](https:\u002F\u002Fsaucelabs.com\u002F).\n\n## Library Size\nAs of version 1.7.3 the payload added to your app is rather small. Served using gzip compression, localForage will add less than 10k to your total bundle size:\n\n\u003Cdl>\n  \u003Cdt>minified\u003C\u002Fdt>\u003Cdd>`~29kB`\u003C\u002Fdd>\n  \u003Cdt>gzipped\u003C\u002Fdt>\u003Cdd>`~8.8kB`\u003C\u002Fdd>\n  \u003Cdt>brotli'd\u003C\u002Fdt>\u003Cdd>`~7.8kB`\u003C\u002Fdd>\n\u003C\u002Fdl>\n\n# License\n\nThis program is free software; it is distributed under an\n[Apache License](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Fblob\u002Fmaster\u002FLICENSE).\n\n---\n\nCopyright (c) 2013-2016 [Mozilla](https:\u002F\u002Fmozilla.org)\n([Contributors](https:\u002F\u002Fgithub.com\u002FlocalForage\u002FlocalForage\u002Fgraphs\u002Fcontributors)).\n","localForage 是一个用于 JavaScript 的快速且简单的存储库，旨在通过使用异步存储（IndexedDB 或 WebSQL）来改善网页应用的离线体验，并提供类似 localStorage 的简单 API。其核心功能包括对多种存储技术的支持、异步操作以及简洁易用的接口设计，支持 Node 风格回调和 Promises 两种编程模式。适用于需要在用户设备上持久化数据但又希望保持良好用户体验的各类Web应用程序场景，尤其是在网络不稳定或完全无网络连接的情况下，能够有效提升应用的数据访问性能与可靠性。",2,"2026-06-11 02:51:55","top_language"]