UNPKG

backendless-coderunner

Version:
21 lines (17 loc) 304 B
module.exports = class LongWaiter { constructor(checker) { this.checker = checker this.promise = new Promise(resolve => { this.resolve = resolve this.check() }) } wait() { return this.promise } check() { if (this.checker()) { this.resolve() } } }