Hastic standalone https://hastic.io
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

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();
}
}