@xterm/xterm 5.6.0-beta.137 → 5.6.0-beta.139

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "5.6.0-beta.137",
4
+ "version": "5.6.0-beta.139",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -108,5 +108,5 @@
108
108
  "ws": "^8.2.3",
109
109
  "xterm-benchmark": "^0.3.1"
110
110
  },
111
- "commit": "65a0e03b667169c50e8baa62310d0e3c5b493aa5"
111
+ "commit": "637231e6e17a3cc85e4d6e3fd9fc03e26b764c1f"
112
112
  }
@@ -45,7 +45,7 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
45
45
 
46
46
  // Only refresh if the time since last refresh is above a threshold, otherwise wait for
47
47
  // enough time to pass before refreshing again.
48
- const refreshRequestTime: number = Date.now();
48
+ const refreshRequestTime: number = performance.now();
49
49
  if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {
50
50
  // Enough time has lapsed since the last refresh; refresh immediately
51
51
  this._lastRefreshMs = refreshRequestTime;
@@ -57,7 +57,7 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
57
57
  this._additionalRefreshRequested = true;
58
58
 
59
59
  this._refreshTimeoutID = window.setTimeout(() => {
60
- this._lastRefreshMs = Date.now();
60
+ this._lastRefreshMs = performance.now();
61
61
  this._innerRefresh();
62
62
  this._additionalRefreshRequested = false;
63
63
  this._refreshTimeoutID = undefined; // No longer need to clear the timeout
@@ -74,14 +74,14 @@ abstract class TaskQueue implements ITaskQueue {
74
74
  let lastDeadlineRemaining = deadline.timeRemaining();
75
75
  let deadlineRemaining = 0;
76
76
  while (this._i < this._tasks.length) {
77
- taskDuration = Date.now();
77
+ taskDuration = performance.now();
78
78
  if (!this._tasks[this._i]()) {
79
79
  this._i++;
80
80
  }
81
- // other than performance.now, Date.now might not be stable (changes on wall clock changes),
82
- // this is not an issue here as a clock change during a short running task is very unlikely
83
- // in case it still happened and leads to negative duration, simply assume 1 msec
84
- taskDuration = Math.max(1, Date.now() - taskDuration);
81
+ // other than performance.now, performance.now might not be stable (changes on wall clock
82
+ // changes), this is not an issue here as a clock change during a short running task is very
83
+ // unlikely in case it still happened and leads to negative duration, simply assume 1 msec
84
+ taskDuration = Math.max(1, performance.now() - taskDuration);
85
85
  longestTask = Math.max(taskDuration, longestTask);
86
86
  // Guess the following task will take a similar time to the longest task in this batch, allow
87
87
  // additional room to try avoid exceeding the deadline
@@ -116,9 +116,9 @@ export class PriorityTaskQueue extends TaskQueue {
116
116
  }
117
117
 
118
118
  private _createDeadline(duration: number): ITaskDeadline {
119
- const end = Date.now() + duration;
119
+ const end = performance.now() + duration;
120
120
  return {
121
- timeRemaining: () => Math.max(0, end - Date.now())
121
+ timeRemaining: () => Math.max(0, end - performance.now())
122
122
  };
123
123
  }
124
124
  }
@@ -137,7 +137,7 @@ export class WriteBuffer extends Disposable {
137
137
  * effectively lowering the redrawing needs, schematically:
138
138
  *
139
139
  * macroTask _innerWrite:
140
- * if (Date.now() - (lastTime | 0) < WRITE_TIMEOUT_MS):
140
+ * if (performance.now() - (lastTime | 0) < WRITE_TIMEOUT_MS):
141
141
  * schedule microTask _innerWrite(lastTime)
142
142
  * else:
143
143
  * schedule macroTask _innerWrite(0)
@@ -158,7 +158,7 @@ export class WriteBuffer extends Disposable {
158
158
  * Note, for pure sync code `lastTime` and `promiseResult` have no meaning.
159
159
  */
160
160
  protected _innerWrite(lastTime: number = 0, promiseResult: boolean = true): void {
161
- const startTime = lastTime || Date.now();
161
+ const startTime = lastTime || performance.now();
162
162
  while (this._writeBuffer.length > this._bufferOffset) {
163
163
  const data = this._writeBuffer[this._bufferOffset];
164
164
  const result = this._action(data, promiseResult);
@@ -186,7 +186,7 @@ export class WriteBuffer extends Disposable {
186
186
  * responsibility to slice hard work), but we can at least schedule a screen update as we
187
187
  * gain control.
188
188
  */
189
- const continuation: (r: boolean) => void = (r: boolean) => Date.now() - startTime >= WRITE_TIMEOUT_MS
189
+ const continuation: (r: boolean) => void = (r: boolean) => performance.now() - startTime >= WRITE_TIMEOUT_MS
190
190
  ? setTimeout(() => this._innerWrite(0, r))
191
191
  : this._innerWrite(startTime, r);
192
192
 
@@ -202,7 +202,8 @@ export class WriteBuffer extends Disposable {
202
202
  * throughput by eval'ing `startTime` upfront pulling at least one more chunk into the
203
203
  * current microtask queue (executed before setTimeout).
204
204
  */
205
- // const continuation: (r: boolean) => void = Date.now() - startTime >= WRITE_TIMEOUT_MS
205
+ // const continuation: (r: boolean) => void = performance.now() - startTime >=
206
+ // WRITE_TIMEOUT_MS
206
207
  // ? r => setTimeout(() => this._innerWrite(0, r))
207
208
  // : r => this._innerWrite(startTime, r);
208
209
 
@@ -222,7 +223,7 @@ export class WriteBuffer extends Disposable {
222
223
  this._bufferOffset++;
223
224
  this._pendingData -= data.length;
224
225
 
225
- if (Date.now() - startTime >= WRITE_TIMEOUT_MS) {
226
+ if (performance.now() - startTime >= WRITE_TIMEOUT_MS) {
226
227
  break;
227
228
  }
228
229
  }