README
apeman-service-preference
Service for preferences.
Installation
$ npm install apeman-service-preference --save
Usage
#!/usr/bin/env node
'use strict'
const { ApPreferenceService } = require('apeman-service-preference')
const { createStore } = require('redux')
const { reducer } = require('apeman-service-base')
const co = require('co')
co(function * () {
let store = createStore(reducer)
let service = new ApPreferenceService(store)
yield service.setPreference('foo', 'This is foo')
/* ... */
let foo = service.getPreference('foo')
console.log(foo)
}).catch((err) => console.error(err))
API
apeman-service-preference@2.0.0
Service for preferences.
- Functions
- ApPreferenceService Class
Functions
ApPreferenceService
create(args) -> Create the service instance
Param | Type | Description |
---|---|---|
args | * |
ApPreferenceService Class
Service
new ApPreferenceService(store, options)
Constructor of ApPreferenceService class
Param | Type | Description |
---|---|---|
store | Object | Redux store |
options | Object | Optional settings |
*
service.getPreference(fieldName) -> Get preference value
Param | Type | Description |
---|---|---|
fieldName |
Promise
service.setPreference(fieldName, value) -> Set preference
Param | Type | Description |
---|---|---|
fieldName | string | Name of preference field |
value | * | Value to set |
Promise
service.deletePreference(fieldName) -> Delete preference
Param | Type | Description |
---|---|---|
fieldName | string | Name of preference field |
License
This software is released under the MIT License.