You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
537 B

4 years ago
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports = class TrackingSet {
  7. constructor(set) {
  8. this.set = set;
  9. this.set2 = new Set();
  10. this.stack = set.stack;
  11. }
  12. add(item) {
  13. this.set2.add(item);
  14. return this.set.add(item);
  15. }
  16. delete(item) {
  17. this.set2.delete(item);
  18. return this.set.delete(item);
  19. }
  20. has(item) {
  21. return this.set.has(item);
  22. }
  23. createChild() {
  24. return this.set.createChild();
  25. }
  26. getAddedItems() {
  27. return this.set2;
  28. }
  29. };