@live-change/framework
Advanced tools
Comparing version 0.3.9 to 0.3.10
@@ -122,4 +122,27 @@ const ReactiveDao = require("@live-change/dao") | ||
condition(id, condition = x => !!x, timeout = 10000) { | ||
return new Promise((resolve, reject) => { | ||
const observable = this.observable(id) | ||
const timeoutId = setTimeout(() => { | ||
observable.unobserve(observer) | ||
return reject(new Error('timeout')) | ||
}, timeout) | ||
const observer = (signal, value) => { | ||
if(signal != 'set') { | ||
observable.unobserve(observer) | ||
clearTimeout(timeoutId) | ||
return reject(new Error(`unknown signal ${signal}`)) | ||
} | ||
if(condition(signal)) { | ||
observable.unobserve(observer) | ||
clearTimeout(timeoutId) | ||
return resolve(value) | ||
} | ||
} | ||
observable.observe(observer) | ||
}) | ||
} | ||
} | ||
module.exports = ReaderModel |
{ | ||
"name": "@live-change/framework", | ||
"version": "0.3.9", | ||
"version": "0.3.10", | ||
"description": "Live Change Framework - ultimate solution for real time mobile/web apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118202
3285