@@ -23,7 +23,6 @@ if (typeof require === "function" && typeof module === "object") {
2323
2424/**
2525 * Queues a function to be called during a browser's idle periods
26- *
2726 * @callback RequestIdleCallback
2827 * @param {function(IdleDeadline) } callback
2928 * @param {{timeout: number} } options - an options object
@@ -106,7 +105,6 @@ if (typeof require === "function" && typeof module === "object") {
106105
107106/**
108107 * Configuration object for the `install` method.
109- *
110108 * @typedef {object } Config
111109 * @property {number|Date } [now] a number (in milliseconds) or a Date object (default epoch)
112110 * @property {string[] } [toFake] names of the methods that should be faked.
@@ -120,7 +118,6 @@ if (typeof require === "function" && typeof module === "object") {
120118/* eslint-disable jsdoc/require-property-description */
121119/**
122120 * The internal structure to describe a scheduled fake timer
123- *
124121 * @typedef {object } Timer
125122 * @property {Function } func
126123 * @property {*[] } args
@@ -134,7 +131,6 @@ if (typeof require === "function" && typeof module === "object") {
134131
135132/**
136133 * A Node timer
137- *
138134 * @typedef {object } NodeImmediate
139135 * @property {function(): boolean } hasRef
140136 * @property {function(): NodeImmediate } ref
@@ -146,7 +142,6 @@ if (typeof require === "function" && typeof module === "object") {
146142
147143/**
148144 * Mocks available features in the specified global namespace.
149- *
150145 * @param {* } _global Namespace to mock (e.g. `window`)
151146 * @returns {FakeTimers }
152147 */
@@ -276,7 +271,6 @@ function withGlobal(_global) {
276271 * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into
277272 * number of milliseconds. This is used to support human-readable strings passed
278273 * to clock.tick()
279- *
280274 * @param {string } str
281275 * @returns {number }
282276 */
@@ -312,7 +306,6 @@ function withGlobal(_global) {
312306
313307 /**
314308 * Get the decimal part of the millisecond value as nanoseconds
315- *
316309 * @param {number } msFloat the number of milliseconds
317310 * @returns {number } an integer number of nanoseconds in the range [0,1e6)
318311 *
@@ -329,7 +322,6 @@ function withGlobal(_global) {
329322
330323 /**
331324 * Used to grok the `now` parameter to createClock.
332- *
333325 * @param {Date|number } epoch the system time
334326 * @returns {number }
335327 */
@@ -483,7 +475,6 @@ function withGlobal(_global) {
483475 /**
484476 * A normal Class constructor cannot be called without `new`, but Date can, so we need
485477 * to wrap it in a Proxy in order to ensure this functionality of Date is kept intact
486- *
487478 * @type {ClockDate }
488479 */
489480 const ClockDateProxy = new Proxy ( ClockDate , {
@@ -510,7 +501,6 @@ function withGlobal(_global) {
510501 * Most of the properties are the original native ones,
511502 * but we need to take control of those that have a
512503 * dependency on the current clock.
513- *
514504 * @returns {object } the partly fake Intl implementation
515505 */
516506 function createIntl ( ) {
@@ -683,7 +673,6 @@ function withGlobal(_global) {
683673 /* eslint consistent-return: "off" */
684674 /**
685675 * Timer comparitor
686- *
687676 * @param {Timer } a
688677 * @param {Timer } b
689678 * @returns {number }
@@ -815,7 +804,6 @@ function withGlobal(_global) {
815804
816805 /**
817806 * Gets clear handler name for a given timer type
818- *
819807 * @param {string } ttype
820808 */
821809 function getClearHandler ( ttype ) {
@@ -827,7 +815,6 @@ function withGlobal(_global) {
827815
828816 /**
829817 * Gets schedule handler name for a given timer type
830- *
831818 * @param {string } ttype
832819 */
833820 function getScheduleHandler ( ttype ) {
@@ -1183,13 +1170,11 @@ function withGlobal(_global) {
11831170
11841171 /**
11851172 * A high resolution timestamp in milliseconds.
1186- *
11871173 * @typedef {number } DOMHighResTimeStamp
11881174 */
11891175
11901176 /**
11911177 * performance.now()
1192- *
11931178 * @returns {DOMHighResTimeStamp }
11941179 */
11951180 function fakePerformanceNow ( ) {
@@ -1848,6 +1833,9 @@ function withGlobal(_global) {
18481833 new FakePerformanceEntry ( name , "mark" , 0 , 0 ) ;
18491834 clock . performance . measure = ( name ) =>
18501835 new FakePerformanceEntry ( name , "measure" , 0 , 100 ) ;
1836+ // `timeOrigin` should return the time of when the Window session started
1837+ // (or the Worker was installed)
1838+ clock . performance . timeOrigin = getEpoch ( config . now ) ;
18511839 } else if ( ( config . toFake || [ ] ) . includes ( "performance" ) ) {
18521840 return handleMissingTimer ( "performance" ) ;
18531841 }
0 commit comments