fix(CinePlayer): always show cine player for dynamic data (#4575)

Co-authored-by: Ibrahim <ibrahim.mdev@gmail.com>
This commit is contained in:
AlirezaandIbrahim authored and GitHub committed 2024-12-05 11:30:21 -05:00
1 parent 72a35ce905
commit b8e8bbe482
20 files changed
+122 -59

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
/**
*
* @param action The action function to attempt
* @param attempts The number of attempts to try the action
* @param delay delay between attempts
* @returns True if the action is successful, otherwise throws an error
*/
export const attemptAction = async (action: () => Promise<void>, attempts = 10, delay = 100) => {
for (let i = 1; i < attempts; i++) {
try {
await action();
return true;
} catch (error) {
if (i === attempts) {
throw new Error('Action failed.');
}
await new Promise(resolve => setTimeout(resolve, delay));
}
}
};