@netless/slide 1.4.61-beta.0 → 1.4.62-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/lib/FrozenTaskManager.d.ts +0 -1
- package/lib/FrozenTaskManager.js +34 -48
- package/lib/Slide.d.ts +35 -4
- package/lib/Slide.js +7 -7
- package/package.json +1 -1
- package/lib/PlayerContextReleaseWait.js +0 -41
package/package.json
CHANGED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wait for the browser to finish releasing a destroyed WebGL context before
|
|
3
|
-
* creating a replacement player. Uses rAF when available, but always settles
|
|
4
|
-
* within a bounded timeout so hidden/background WebViews cannot hang release.
|
|
5
|
-
*/
|
|
6
|
-
export function waitForPlayerContextRelease(platform) {
|
|
7
|
-
var isMobile = platform.isIOS() || platform.isAndroid();
|
|
8
|
-
var minFrames = isMobile ? 4 : 2;
|
|
9
|
-
var settleMs = isMobile ? 100 : 16;
|
|
10
|
-
var maxWaitMs = isMobile ? 500 : 200;
|
|
11
|
-
return new Promise(function (resolve) {
|
|
12
|
-
var settled = false;
|
|
13
|
-
var complete = function () {
|
|
14
|
-
if (settled) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
settled = true;
|
|
18
|
-
setTimeout(resolve, settleMs);
|
|
19
|
-
};
|
|
20
|
-
var timeoutId = setTimeout(complete, maxWaitMs);
|
|
21
|
-
var frameCount = 0;
|
|
22
|
-
var nextFrame = function () {
|
|
23
|
-
if (settled) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
frameCount += 1;
|
|
27
|
-
if (frameCount >= minFrames) {
|
|
28
|
-
clearTimeout(timeoutId);
|
|
29
|
-
complete();
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (typeof window.requestAnimationFrame === "function") {
|
|
33
|
-
window.requestAnimationFrame(nextFrame);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
setTimeout(nextFrame, 0);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
nextFrame();
|
|
40
|
-
});
|
|
41
|
-
}
|