diff --git a/packages/runtime/src/Store.ts b/packages/runtime/src/Store.ts index 805af7b2..573151a8 100644 --- a/packages/runtime/src/Store.ts +++ b/packages/runtime/src/Store.ts @@ -4,7 +4,7 @@ export interface IStoreValue { [x: string]: any } -class Node { +/* class Node { constructor ( public value: T, public next: Node | null = null @@ -41,23 +41,23 @@ class Queue { public clear (): void { this.head = this.tail = null } -} +} */ export class Store { protected _values: Array - private readonly _freeList: Queue + private _freeList: number[] private _size: number public constructor (capacity: number) { this._values = [undefined] this._values.length = capacity this._size = 1 - this._freeList = new Queue() + this._freeList = [] } public add (value: V): void { let id: number - if (this._freeList.head) { + if (this._freeList.length) { id = this._freeList.shift()! } else { id = this._size @@ -95,6 +95,6 @@ export class Store { } this._values = [undefined] this._size = 1 - this._freeList.clear() + this._freeList = [] } }