Usage.js 860 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.Usage = void 0;
  4. var Usage = (function () {
  5. function Usage() {
  6. this.used = new Set();
  7. this.needsUpdate = [];
  8. }
  9. Usage.prototype.add = function (item) {
  10. var name = JSON.stringify(item);
  11. if (!this.used.has(name)) {
  12. this.needsUpdate.push(item);
  13. }
  14. this.used.add(name);
  15. };
  16. Usage.prototype.has = function (item) {
  17. return this.used.has(JSON.stringify(item));
  18. };
  19. Usage.prototype.clear = function () {
  20. this.used.clear();
  21. this.needsUpdate = [];
  22. };
  23. Usage.prototype.update = function () {
  24. var update = this.needsUpdate;
  25. this.needsUpdate = [];
  26. return update;
  27. };
  28. return Usage;
  29. }());
  30. exports.Usage = Usage;
  31. //# sourceMappingURL=Usage.js.map