{"id":17597871,"url":"https://github.com/cvan/focalstorage","last_synced_at":"2025-06-20T18:33:05.757Z","repository":{"id":57239567,"uuid":"37434474","full_name":"cvan/focalStorage","owner":"cvan","description":"a Promise-based, localStorage-like wrapper around IndexedDB","archived":false,"fork":false,"pushed_at":"2017-01-09T12:06:24.000Z","size":148,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T09:50:17.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cvan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-14T23:57:57.000Z","updated_at":"2021-04-01T17:08:04.000Z","dependencies_parsed_at":"2022-08-30T00:11:23.616Z","dependency_job_id":null,"html_url":"https://github.com/cvan/focalStorage","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2FfocalStorage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2FfocalStorage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2FfocalStorage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2FfocalStorage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cvan","download_url":"https://codeload.github.com/cvan/focalStorage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246240491,"owners_count":20745879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-22T09:43:56.870Z","updated_at":"2025-03-29T20:27:46.565Z","avatar_url":"https://github.com/cvan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# focalStorage\n\nfocalStorage is a Promise-based, localStorage-like wrapper around asynchronous\nIndexedDB storage.\n\nfocalStorage works wherever IndexedDB is supported. localStorage fallback coming soon.\n\nTo use focalStorage, just drop a single JavaScript file into your page:\n\n```html\n\u003cscript src=\"focalStorage.js\"\u003e\u003c/script\u003e\n\u003cscript\u003efocalStorage.getItem('something', myCallback);\u003c/script\u003e\n```\n\nDownload the [latest focalStorage from GitHub](https://github.com/cvan/focalStorage/releases/latest), or install with [npm](https://www.npmjs.org/):\n\n```bash\nnpm install focalStorage\n```\n\nfocalStorage is compatible with [browserify](http://browserify.org/).\n\n\n## How to use focalStorage\n\nBecause focalStorage uses async storage, it has an async API.\nIt's otherwise exactly the same as the\n[Local Storage API](https://hacks.mozilla.org/2009/06/localstorage/).\n\nfocalStorage relies on native [ES6 Promises](http://www.promisejs.org/) (polyfilled by Babel, where unsupported).\n\nDon't expect a return value from calls to `focalStorage.getItem()`. Instead,\nuse Promises:\n\n```js\n// Synchronous; slower!\nvar value = JSON.parse(localStorage.getItem('key'));\nconsole.log(value);\n\n// Async, fast, and non-blocking!\nfocalStorage.setItem('key', 'value').then(function (value) {\n  console.log(value + ' was set!');\n}, function (error) {\n  console.error(error);\n});\n```\n\n### Configuration\n\nYou can set database information with the `focalStorage.config` method.\nAvailable options are `driver`, `name`, `version`, and `storeName`.\n\nExample:\n\n```js\nfocalStorage.config({\n  driver: focalStorage.INDEXEDDB,  // Force IndexedDB. Or `focalStorage.INDEXEDDB` for localStorage.\n  name: 'myApp',\n  version: 1.0,\n  storeName: 'keyvaluepairs',  // Limit to alphanumeric characters and underscores.\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\n## Working on focalStorage\n\nYou'll need [Node + npm](http://nodejs.org/).\n\nTo work on focalStorage, you should start by\n[forking it](https://github.com/cvan/focalStorage/fork) and installing its\ndependencies. Replace `USERNAME` with your GitHub username and run the\nfollowing:\n\n```bash\ngit clone git@github.com:USERNAME/focalStorage.git\ncd focalStorage\nnpm install\n```\n\n### Building the bundle\n\nRun this command to compile the JavaScript as a standalone module to __`dist/focalStorage.js`__:\n\n    npm run build\n\n\n## Maintainers\n\nRun this command to publish a new tag to GitHub and version to npm:\n\n    npm run release\n\n\n## Licence\n\nThis program is free software and is distributed under an\n[MIT License](https://github.com/cvan/focalStorage/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvan%2Ffocalstorage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvan%2Ffocalstorage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvan%2Ffocalstorage/lists"}