提交 70a0137e 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

use currentState() & targetState() in puppet

上级 a46b1a7e
......@@ -18,20 +18,43 @@ class Puppet extends EventEmitter {
super()
/*
* @deprecated
* connected / disconnected
* connecting / disconnecting
*/
this._readyState = 'disconnected'
// this._readyState = 'disconnected'
this.targetState('dead')
this.currentState('dead')
}
// targetState : 'live' | 'dead'
targetState(newState) {
if (newState) {
log.verbose('Puppet', 'targetState(%s)', newState)
this._targetState = newState
}
return this._targetState
}
readyState(newState) {
// currentState : 'birthing' | 'killing'
currentState(newState) {
if (newState) {
log.verbose('Puppet', 'readyState() set to "%s"', newState)
this._readyState = newState
log.verbose('Puppet', 'currentState(%s)', newState)
this._currentState = newState
}
return this._readyState
return this._currentState
}
// @deprecated
// readyState(newState) {
// if (newState) {
// log.verbose('Puppet', 'readyState() set to "%s"', newState)
// this._readyState = newState
// }
// return this._readyState
// }
/**
* let puppet send message
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册