ready-mixin
You have class with async constructor and you don't want use callback in constructor or make inheritance from some event emitter? Try ready-mixin!
Installation
npm install ready-mixin
API
_ready(err, ...)
Resolve or reject ready promise.
ready()
Return ready promise.
return: Promise
onReady(callback, opts)
function
callback is node-style callback functionObject
[opts]boolean
[spread]
isReady()
Return current ready status.
return: boolean
Examples
@ { db } let user = 0userready
spread in onReady
@ { } let a = a
License
Code released under the MIT license.