sync-mixin

1.0.2 • Public • Published

sync-mixin

NPM Package Build Status Coverage Status js-standard-style Dependency status

Installation

npm install sync-mixin

API

_getSyncCount()

return: number

_setSyncCount()

  • number value

_syncEnter()

_syncExit()

_withSync()

  • function fn

return: Promise

_syncExitAll()

isSyncing()

Examples

import { mixin } from 'core-decorators'
import SyncMixin from 'sync-mixin'
 
@mixin(SyncMixin)
class Process {
  run () {
    return this._withSync(() => {
      // some code that require time for execution
    })
  }
}
 
let process = new Process()
process.on('syncStart', () => console.log('Syncronization started!'))
process.on('syncStop', () => console.log('Syncronization finished!'))
setInterval(::process.run, 60 * 1000)

License

This software is licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i sync-mixin

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • fanatid