perf(objects): memoize () => this._pool
This commit is contained in:
parent
f9173c41d1
commit
6534ffea26
@ -253,10 +253,13 @@ export class Xapi extends EventEmitter {
|
|||||||
this.on('connected', this._watchEvents)
|
this.on('connected', this._watchEvents)
|
||||||
this.on('disconnected', () => {
|
this.on('disconnected', () => {
|
||||||
this._fromToken = ''
|
this._fromToken = ''
|
||||||
objects.clear()
|
// objects.clear()
|
||||||
})
|
})
|
||||||
|
|
||||||
this._readOnly = Boolean(opts.readOnly)
|
this._readOnly = Boolean(opts.readOnly)
|
||||||
|
|
||||||
|
// Memoize this function _addObject().
|
||||||
|
this._getPool = () => this._pool
|
||||||
}
|
}
|
||||||
|
|
||||||
get readOnly () {
|
get readOnly () {
|
||||||
@ -557,7 +560,7 @@ export class Xapi extends EventEmitter {
|
|||||||
// All custom properties are read-only and non enumerable.
|
// All custom properties are read-only and non enumerable.
|
||||||
defineProperties(object, {
|
defineProperties(object, {
|
||||||
$id: { value: object.uuid || ref },
|
$id: { value: object.uuid || ref },
|
||||||
$pool: { get: () => this._pool },
|
$pool: { get: this._getPool },
|
||||||
$ref: { value: ref },
|
$ref: { value: ref },
|
||||||
$type: { value: type }
|
$type: { value: type }
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user