3.0.1 • Published 8 years ago

apeman-service-spin v3.0.1

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

apeman-service-spin

Build Status npm Version JS Standard

Service for spin

Installation

$ npm install apeman-service-spin --save

Usage

#!/usr/bin/env node

'use strict'

const { ApSpinService } = require('apeman-service-spin')
const { createStore } = require('redux')
const { reducer } = require('apeman-service-base')
const co = require('co')

co(function * () {
  let store = createStore(reducer)
  let service = new ApSpinService(store)

  yield service.initSpin('ROOT_SPIN')

  yield service.spinWhile('ROOT_SPIN', () => {
    return Promise.resolve(true)
  })

  let spinning = service.hasSpin('ROOT_SPIN')
  console.log(spinning)
}).catch((err) => console.error(err))

API

apeman-service-spin@3.0.1

Service for spin

Functions

create(args) -> ApSpinService

Create the service instance

ParamTypeDescription
args*

ApSpinService Class

Service to handle spin.

new ApSpinService(store, options)

Constructor of ApSpinService class

ParamTypeDescription
storeObjectRedux store
optionsObjectOptional settings

service.countSpin(spinName) -> number

Count active spins

ParamTypeDescription
spinNamestringName of spin

service.hasSpin(spinName) -> boolean

Detect has a spin or not

ParamTypeDescription
spinNamestringName of spin

service.spinWhile(spinName, action) -> Promise

Show spin while promise pending

ParamTypeDescription
spinNamestringName of spin
actionfunction-

service.initSpin(spinName) -> Promise

Init spin value

ParamTypeDescription
spinNamestringName of spin.

service.showSpin(spinName) -> Promise

Show a spin

ParamTypeDescription
spinNamestringName of spin.

service.hideSpin(spinName) -> Promise

Hide a spin

ParamTypeDescription
spinNamestringName of spin.

License

This software is released under the MIT License.

Links

3.0.1

8 years ago

3.0.0

8 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago