ntk 5.1.0 → 5.2.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/lib/window.js +24 -0
- package/package.json +1 -1
package/lib/window.js
CHANGED
|
@@ -918,6 +918,30 @@ export default class Window extends Drawable {
|
|
|
918
918
|
if (idx !== -1) f.rafCbs.splice(idx, 1);
|
|
919
919
|
}
|
|
920
920
|
|
|
921
|
+
/**
|
|
922
|
+
* Whether the fence for the last frame is still unanswered — the server has
|
|
923
|
+
* not yet confirmed it consumed everything that frame drew.
|
|
924
|
+
*
|
|
925
|
+
* The one bit of frame-clock state worth publishing, because it is the
|
|
926
|
+
* difference between the two ways a toolkit can answer a discrete input.
|
|
927
|
+
* Drawing the response inside the event handler costs a frame less latency:
|
|
928
|
+
* the blit goes out with the handler's own requests (see the `_present()`
|
|
929
|
+
* at the end of the event dispatch) instead of waiting for the next paced
|
|
930
|
+
* frame. Drawing it while a frame is in flight costs a frame's *work* for
|
|
931
|
+
* nothing: the present is deferred until the ack and coalesces with the
|
|
932
|
+
* one already pending, so only the last paint is ever seen. So `false`
|
|
933
|
+
* means "draw it now", `true` means "leave it to the frame clock" — which
|
|
934
|
+
* is how a burst of discrete events (a spun wheel) paints its first notch
|
|
935
|
+
* immediately and folds the rest into one catch-up frame.
|
|
936
|
+
*
|
|
937
|
+
* Always `false` under `frameSync: false`: no fence is ever sent, so there
|
|
938
|
+
* is nothing to wait for, and a caller gating on this gets the unpaced
|
|
939
|
+
* behaviour that option asks for.
|
|
940
|
+
*/
|
|
941
|
+
frameInFlight() {
|
|
942
|
+
return this._frame.inFlight;
|
|
943
|
+
}
|
|
944
|
+
|
|
921
945
|
_present() {
|
|
922
946
|
if (!this._backing) return;
|
|
923
947
|
if (this._frame.inFlight) {
|