apeman-service-preference
Service for preferences.
Last updated 2 years ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install apeman-service-preference 
SYNC missed versions from official npm registry.

apeman-service-preference

Build Status npm Version JS Standard

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

create(args) -> ApPreferenceService

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

service.setPreference(fieldName, value) -> Promise

Set preference

Param Type Description
fieldName string Name of preference field
value * Value to set

service.deletePreference(fieldName) -> Promise

Delete preference

Param Type Description
fieldName string Name of preference field

License

This software is released under the MIT License.

Links

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 29
Dependencies (4)
Dev Dependencies (14)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |