fix(debounce): it can be changed at runtime
This commit is contained in:
parent
cb56b3b9d0
commit
a2faedcacb
@ -607,13 +607,12 @@ export class Xapi extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_watchEvents () {
|
_watchEvents () {
|
||||||
const debounce = this._debounce
|
|
||||||
|
|
||||||
const loop = invoke(() => {
|
const loop = invoke(() => {
|
||||||
const onSuccess = ({token, events}) => {
|
const onSuccess = ({token, events}) => {
|
||||||
this._fromToken = token
|
this._fromToken = token
|
||||||
this._processEvents(events)
|
this._processEvents(events)
|
||||||
|
|
||||||
|
const debounce = this._debounce
|
||||||
return debounce != null
|
return debounce != null
|
||||||
? Bluebird.delay(debounce).then(loop)
|
? Bluebird.delay(debounce).then(loop)
|
||||||
: loop()
|
: loop()
|
||||||
@ -689,9 +688,10 @@ export class Xapi extends EventEmitter {
|
|||||||
|
|
||||||
const watchEvents = invoke(() => {
|
const watchEvents = invoke(() => {
|
||||||
const loop = invoke(() => {
|
const loop = invoke(() => {
|
||||||
const debounce = this._debounce
|
|
||||||
const onSuccess = events => {
|
const onSuccess = events => {
|
||||||
this._processEvents(events)
|
this._processEvents(events)
|
||||||
|
|
||||||
|
const debounce = this._debounce
|
||||||
return debounce == null
|
return debounce == null
|
||||||
? loop()
|
? loop()
|
||||||
: Bluebird.delay(debounce).then(loop)
|
: Bluebird.delay(debounce).then(loop)
|
||||||
|
Loading…
Reference in New Issue
Block a user