README
apeman-service-session
Apeman service for sessions.
Installation
$ npm install apeman-service-session --save
Usage
#!/usr/bin/env node
'use strict'
const { ApSessionService } = require('apeman-service-session')
const { createStore } = require('redux')
const { reducer } = require('apeman-service-base')
const co = require('co')
co(function * () {
let store = createStore(reducer)
let service = new ApSessionService(store)
}).catch((err) => console.error(err))
API
apeman-service-session@1.2.1
Apeman service for sessions.
- Functions
- ApSessionService Class
Functions
ApSessionService
create(args) -> Create the service instance
Param | Type | Description |
---|---|---|
args | * |
ApSessionService Class
Service
new ApSessionService(store, options)
Constructor of ApSessionService class
Param | Type | Description |
---|---|---|
store | Object | Redux store |
options | Object | Optional settings |
*
service.getSession(fieldName) -> Get session value
Param | Type | Description |
---|---|---|
fieldName | string | Name of field. |
Promise
service.setSession(fieldName, value) -> Set session value
Param | Type | Description |
---|---|---|
fieldName | string | Name of field. |
value | * | Value to set |
Promise
service.delSession(fieldName) -> Delete session value
Param | Type | Description |
---|---|---|
fieldName | string | Name of field. |
Promise
service.syncSession(fieldName, value) -> Sync session values. Delete if no value passed.
Param | Type | Description |
---|---|---|
fieldName | string | Name of field. |
value | * | Value to set |
License
This software is released under the MIT License.