2.0.0 • Published 7 years ago

apeman-service-preference v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

ParamTypeDescription
args*

ApPreferenceService Class

Service

new ApPreferenceService(store, options)

Constructor of ApPreferenceService class

ParamTypeDescription
storeObjectRedux store
optionsObjectOptional settings

service.getPreference(fieldName) -> *

Get preference value

ParamTypeDescription
fieldName

service.setPreference(fieldName, value) -> Promise

Set preference

ParamTypeDescription
fieldNamestringName of preference field
value*Value to set

service.deletePreference(fieldName) -> Promise

Delete preference

ParamTypeDescription
fieldNamestringName of preference field

License

This software is released under the MIT License.

Links

2.0.0

7 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago