main.js 533 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. class Lazy {
  6. constructor(creator) {
  7. this.creator = creator;
  8. }
  9. get hasValue() {
  10. return this.creator == null;
  11. }
  12. get value() {
  13. if (this.creator == null) {
  14. return this._value;
  15. }
  16. this.value = this.creator();
  17. return this._value;
  18. }
  19. set value(value) {
  20. this._value = value;
  21. this.creator = null;
  22. }
  23. }
  24. exports.Lazy = Lazy; //# sourceMappingURL=main.js.map