KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
ember-lokijs
★ 9
Open GitHub ↗
A LokiJS adapter for Ember.js
Download README (.md)
Explore Similar Repositories
babel-plugin-transform-es2015-classes-simple
:
No description available.
node-widgets
:
A collection of Reddit specific React components and the Redux actions and reducers to accompany them
Swift-Prototype
:
Design Patterns in Swift: Prototype
Home-Automation-Course
:
Try the new eBook version »
sdrsharp-catcontroller
:
CAT (TS-50) for SDRSharp
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
ember-lokijs
?
Download (.md)
[](https://badge.fury.io/js/ember-lokijs) [](https://travis-ci.org/patience-tema-baron/ember-lokijs) # ember-lokijs [LokiJS](https://github.com/techfort/LokiJS) is a highly performant localStorage/sessionStorage/indexedDB interface. This addon wraps Loki and also provides an extensible adapter and serializer so you can easily use it with Ember Data models. ## Installation `ember install ember-lokijs` ## Usage First, add the `LokiJSModelMixin` to your model: ```js // models/foo.js import DS from 'ember-data'; import { LokiJSModelMixin } from 'ember-lokijs'; export default DS.Model.extend(LokiJSModelMixin, { }); ``` Next, extend a `LokiJSAdapter` for your model: ```js // adapters/foos.js import { LokiJSAdapter } from 'ember-lokijs'; export default LokiJSAdapter; ``` Finally, extend a `LokiJSSerializer` for your model: ```js // serializer/foos.js import { LokiJSSerializer } from 'ember-lokijs'; export default LokiJSSerializer; ``` And that's it! ### `indices` If you want a particular query to be faster, you can index its attributes in your adapter: ```js // adapters/user.js import { LokiJSAdapter } from 'ember-lokijs'; export default LokiJSAdapter.extend({ indices: ['username', 'email'] }); ``` ### `databaseName` By default, the adapter will place all models in the same database named `ember-lokijs`. If you wish to place them in separate databases, simply provide your adapters with unique `databaseName`: ```js // adapters/user.js import { LokiJSAdapter } from 'ember-lokijs'; export default LokiJSAdapter.extend({ databaseName: 'user-db' }); ``` ### `lokiOptions` If you want to pass in options to the lokijs constructor, you can specify them: ```js // adapters/user.js import { LokiJSAdapter } from 'ember-lokijs'; export default LokiJSAdapter.extend({ lokiOptions: { adapter: new LokiIndexedAdapter(), autosave: true } }); ```