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

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

Param Type Description
args *

ApSpinService Class

Service to handle spin.

new ApSpinService(store, options)

Constructor of ApSpinService class

Param Type Description
store Object Redux store
options Object Optional settings

service.countSpin(spinName) -> number

Count active spins

Param Type Description
spinName string Name of spin

service.hasSpin(spinName) -> boolean

Detect has a spin or not

Param Type Description
spinName string Name of spin

service.spinWhile(spinName, action) -> Promise

Show spin while promise pending

Param Type Description
spinName string Name of spin
action function -

service.initSpin(spinName) -> Promise

Init spin value

Param Type Description
spinName string Name of spin.

service.showSpin(spinName) -> Promise

Show a spin

Param Type Description
spinName string Name of spin.

service.hideSpin(spinName) -> Promise

Hide a spin

Param Type Description
spinName string Name of spin.

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 0
Last Month 40
Dependencies (4)
Dev Dependencies (14)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |