{"id":21262351,"url":"https://github.com/johanbrook/indexeddbstore","last_synced_at":"2025-03-15T07:42:28.726Z","repository":{"id":17694605,"uuid":"20500606","full_name":"johanbrook/indexeddbstore","owner":"johanbrook","description":"Promise based client-side wrapper for HTML5 IndexedDB in the browser.","archived":false,"fork":false,"pushed_at":"2014-06-04T23:41:02.000Z","size":1404,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-07T13:02:04.402Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johanbrook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-04T21:01:34.000Z","updated_at":"2014-11-12T17:33:24.000Z","dependencies_parsed_at":"2022-09-12T08:41:45.219Z","dependency_job_id":null,"html_url":"https://github.com/johanbrook/indexeddbstore","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanbrook%2Findexeddbstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanbrook%2Findexeddbstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanbrook%2Findexeddbstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanbrook%2Findexeddbstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johanbrook","download_url":"https://codeload.github.com/johanbrook/indexeddbstore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243589312,"owners_count":20315469,"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-11-21T04:58:13.450Z","updated_at":"2025-03-15T07:42:28.704Z","avatar_url":"https://github.com/johanbrook.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IndexedDB Data Storage Module\n\nPromise based client-side wrapper for HTML5 IndexedDB in the browser, built with [Browserify](http://browserify.org/).\n\n## Install\n\nVia NPM:\n\n\tnpm install indexeddbstore\n\nOr just download [a release](https://github.com/johanbrook/indexeddbstore/releases) package and grab the contents in the `dist` directory and put in a `script` tag.\n\n## API\n\nIndexedDBStore is built according to CommonJS principles. Thus the module is able to be imported in the browser using Browserify and the common `require()` function. Else, `window.IndexedDBStore` is available.\n\n\tvar IndexedDBStore = require('indexeddbstore')\n\n\tvar Store = new IndexedDBStore({\n\t\tdbName: \"DEFAULT\",\t// String\n\t\tstores: ['store']\t // Array with store names to create\n\t})\n\n\tStore.save(Object|Array).then(function(guid) {\n\t\tconsole.log(\"GUID: \", guid)\n\t\t// =\u003e String|Array\n\t})\n\n\tStore.save(Object, \"existing-guid\").then(function(guid) {\n\t\tconsole.log(\"GUID: \", guid)\n\t\t// =\u003e String \"existing-guid\"\n\t})\n\n\tStore.create(Object).then(function(record) {\n\t\tconsole.log(\"Record: \", record)\n\t\t// =\u003e Object {data: Object, guid: String}\n\t})\n\n\t// ... Store#create supports the same method signatures as Store#save\n\n\tStore.get(\"guid\").then(function(record) {\n\t\tconsole.log(\"Record: \", record)\n\t\t// =\u003e Object {data: Object, guid: String}\n\t})\n\n\tStore.get( [\"guid1\", \"guid2\"] ).then(function(records) {\n\t\tconsole.log(\"Records: \", records)\n\t\t// =\u003e Array [ {data: {foo: \"bar\"}, guid: String guid1}, {data: {foo: \"bar\"}, guid: String guid2} ]\n\t})\n\n\tStore.all().then(function(records) {\n\t\tconsole.log(\"Records: \", records)\n\t\t// =\u003e Array\n\t})\n\n\tStore.size().then(function(size) {\n\t\tconsole.log(\"Size: \", size)\n\t\t// =\u003e Number\n\t})\n\n\tStore.clear().then(function() {\n\t\tconsole.log(\"Cleared store\")\n\t\t// Post-con: Store#size() === 0\n\t})\n\n\tStore.use('store-name').save( ... )\n\t// Returns the same instance but will operate on the specified store name.\n\t// Will remember the store for next operation.\n\nAll methods returns a `Promise`, except for `Store#use`.\n\n## Build tasks\n\n[Gulp](http://gulpjs.com/) is used for build tasks. Be sure to run `npm install` to install all dependencies.\n\n\t# Default: builds bundle.js from lib/IndexedDBStore.js\n\tgulp\n\tgulp build\n\n\t# Watches lib/IndexedDBStore.js for changes and generates a build\n\tgulp watch\n\n\t# Removes `build`\n\tgulp clean\n\n## Develop\n\nYou have to have a watch task running in order to let Browserify build a concatenated file will all dependencies.\n\n\tnpm install\n\tgulp watch\n\nA task for building files ready for distribution is available:\n\n\tgulp dist\n\nThis will create files `dist/indexeddbstore.js` and `dist/indexeddbstore.min.js`.\n\nA concatenated `bundle.js` will be generated in the `build` directory.\n\n## Tests\n\nTests reside in the `test/tests.js` file, and uses Mocha and Chai.js.\n\n\tgulp test\n\nVisit [http://localhost:3000/test/runner.html](http://localhost:3000/test/runner.html) in your browser to view the Mocha test runner. The `gulp test` task will start a static Connect file server and re-build the main and test files when any of their sources are edited (e.g. the `build/bundle.js` and `test/bundle-test.js` files will be re-built on save).\n\nThanks to Browserify, the tests are using `require()` to import the library files, including `utils.js`. The following task will build the test bundle used in the test runner HTML file:\n\n\tgulp build-test\n\nThis is automatically called in `gulp test`.\n\nTests run in a browser window for now, since headless browsers like PhantomJS don't support the `IndexedDB` API yet (as of PhantomJS 1.9).\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanbrook%2Findexeddbstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohanbrook%2Findexeddbstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanbrook%2Findexeddbstore/lists"}