|
|
@ -22,7 +22,7 @@ function AsyncTimeout(thing, interval)
|
|
|
|
} catch(e) { reject(e); }
|
|
|
|
} catch(e) { reject(e); }
|
|
|
|
}, interval);
|
|
|
|
}, interval);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.interval = async function*() => {
|
|
|
|
this.interval = async function*() {
|
|
|
|
while(true) {
|
|
|
|
while(true) {
|
|
|
|
yield await new Promise((resolve, reject) => {
|
|
|
|
yield await new Promise((resolve, reject) => {
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
@ -43,4 +43,4 @@ const example = async (_timeout) => {
|
|
|
|
for await (const value of new AsyncTimeout(() => "hi forever", _timeout).interval()) { alert(value); }
|
|
|
|
for await (const value of new AsyncTimeout(() => "hi forever", _timeout).interval()) { alert(value); }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//(async () => { example() })();
|
|
|
|