diff --git a/application/source/types/uniquequeue.mjs b/application/source/types/uniquequeue.mjs index 23ce29631a4f62a68ceb58c8fec9eabaa261fb7c..4d43b391374689cc6664f615669353dde852a659 100644 --- a/application/source/types/uniquequeue.mjs +++ b/application/source/types/uniquequeue.mjs @@ -6,12 +6,13 @@ */ import {Queue} from "./queue.mjs"; +import {internalSymbol} from "../constants.mjs"; import {validateObject} from "./validate.mjs"; export {UniqueQueue} /** - * A UniqueQueue is a queue that contains items only once. + * An UniqueQueue is a queue that contains items only once. * * @license AGPLv3 * @since 1.4.0 @@ -26,7 +27,9 @@ export {UniqueQueue} */ constructor() { super(); - this.unique = new WeakSet(); + this[internalSymbol]={ + unique : new WeakSet() + }; } /** @@ -40,8 +43,8 @@ export {UniqueQueue} validateObject(value); - if (!this.unique.has(value)) { - this.unique.add(value); + if (!this[internalSymbol].unique.has(value)) { + this[internalSymbol].unique.add(value); super.add(value); } @@ -55,7 +58,7 @@ export {UniqueQueue} */ clear() { super.clear(); - this.unique = new WeakSet; + this[internalSymbol].unique = new WeakSet; return this; } @@ -71,7 +74,7 @@ export {UniqueQueue} return undefined; } let value = this.data.shift(); - this.unique.delete(value); + this[internalSymbol].unique.delete(value); return value; }