forked from MapComplete/MapComplete
Autoload OH if country code is not yet loaded
This commit is contained in:
parent
c9478c100a
commit
feab5a19b3
4 changed files with 19 additions and 5 deletions
|
@ -113,12 +113,16 @@ export class UIEventSource<T>{
|
|||
return newSource;
|
||||
}
|
||||
|
||||
public static Chronic(millis: number):UIEventSource<Date>{
|
||||
public static Chronic(millis: number, asLong: () => boolean = undefined): UIEventSource<Date> {
|
||||
const source = new UIEventSource<Date>(undefined);
|
||||
|
||||
function run() {
|
||||
source.setData(new Date());
|
||||
window.setTimeout(run, millis);
|
||||
if (asLong === undefined || asLong()) {
|
||||
window.setTimeout(run, millis);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
return source;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue