apeman-service-spin
Service for spin
Last updated 2 years ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ 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

Current Tags

  • 3.0.1                                ...           latest (2 years ago)

10 Versions

  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 10
This Month 20
Last Day 10
Last Week 0
Last Month 11
Dependencies (4)
Dev Dependencies (14)
Dependents (2)

Copyright 2014 - 2017 © taobao.org |