export async function *getGenerator( duration: number, func: (...args: any[]) => Promise, ...args ): AsyncIterableIterator { const timeout = async () => new Promise( resolve => setTimeout(resolve, duration) ); while(true) { yield await func(...args); await timeout(); } }