Attempt to make *hastic* client which works with old version of hastic-server https://code.corpglory.net/hastic/hastic-server
based on new version of hastic client from https://code.corpglory.net/hastic/hastic
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
308 B
15 lines
308 B
2 years ago
|
export async function *getGenerator<T>(
|
||
|
duration: number,
|
||
|
func: (...args: any[]) => Promise<T>,
|
||
|
...args
|
||
|
): AsyncIterableIterator<T> {
|
||
|
|
||
|
const timeout = async () => new Promise(
|
||
|
resolve => setTimeout(resolve, duration)
|
||
|
);
|
||
|
|
||
|
while(true) {
|
||
|
yield await func(...args);
|
||
|
await timeout();
|
||
|
}
|
||
|
}
|