UNPKG

@surface/core

Version:

Provides core functionality of many @surfaces modules.

17 lines (16 loc) 316 B
export default class Lazy { cache; factory; get value() { if (!this.cache) { this.cache = this.factory(); } return this.cache; } constructor(factory) { this.factory = factory; } reset() { this.cache = undefined; } }