Skip to content

Commit

Permalink
Merge pull request #1179 from basics/feature/deferred
Browse files Browse the repository at this point in the history
fix(entry): replaced `promise.withResolvers`
  • Loading branch information
ThornWalli authored Dec 27, 2024
2 parents 8f1d82d + 1310aea commit bf26b25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/utils/entry.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Deferred from '../classes/Deferred';
import { hasSufficientDownloadPerformance } from './performance';

export const triggerRunCallback = sufficient =>
Expand Down Expand Up @@ -73,7 +74,7 @@ export const hasBatteryPerformanceIssue = async videoBlob => {
};

export const waitForVisibilty = () => {
const { promise, resolve } = Promise.withResolvers();
const { promise, resolve } = new Deferred();
if (document.visibilityState === 'hidden') {
document.addEventListener('visibilitychange', resolve, {
once: true
Expand Down Expand Up @@ -112,7 +113,7 @@ export const canVideoPlay = async blob => {
video.playsinline = true;
video.src = objectUrl;

const { resolve, promise } = Promise.withResolvers();
const { promise, resolve } = new Deferred();
const timeout = window.setTimeout(resolve, 500);

await Promise.race([video.play(), promise]);
Expand Down

0 comments on commit bf26b25

Please sign in to comment.