apeman-service-preference

Service for preferences.

Usage no npm install needed!

<script type="module">
  import apemanServicePreference from 'https://cdn.skypack.dev/apeman-service-preference';
</script>

README

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