sync-mixin
v1.0.2
Published
Emit events about sync
Downloads
8
Readme
sync-mixin
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.