@gjsify/perf_hooks 0.3.19 → 0.3.21
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/esm/index.js +1 -1
- package/package.json +3 -3
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;if(globalThis.performance)e=globalThis.performance;else{let t,
|
|
1
|
+
let e;if(globalThis.performance)e=globalThis.performance;else{let t,_now;try{let e=globalThis.imports.gi.GLib;t=e.get_monotonic_time(),_now=()=>(e.get_monotonic_time()-t)/1e3}catch{let e=Date.now();t=0,_now=()=>Date.now()-e}let n=[],r=Date.now()-_now();e={timeOrigin:r,now:_now,mark(e){let t={name:e,entryType:`mark`,startTime:_now(),duration:0};return n.push(t),t},measure(e,t,r){let i=0,a=_now();if(t){let e=n.find(e=>e.entryType===`mark`&&e.name===t);e&&(i=e.startTime)}if(r){let e=n.find(e=>e.entryType===`mark`&&e.name===r);e&&(a=e.startTime)}let o={name:e,entryType:`measure`,startTime:i,duration:a-i};return n.push(o),o},getEntries(){return[...n]},getEntriesByName(e){return n.filter(t=>t.name===e)},getEntriesByType(e){return n.filter(t=>t.entryType===e)},clearMarks(e){for(let t=n.length-1;t>=0;t--)n[t].entryType===`mark`&&(!e||n[t].name===e)&&n.splice(t,1)},clearMeasures(e){for(let t=n.length-1;t>=0;t--)n[t].entryType===`measure`&&(!e||n[t].name===e)&&n.splice(t,1)},clearResourceTimings(){},setResourceTimingBufferSize(){},toJSON(){return{timeOrigin:r}}}}var PerformanceObserverStub=class{_callback;constructor(e){this._callback=e}observe(e){}disconnect(){}takeRecords(){return[]}},PerformanceEntryStub=class{name=``;entryType=``;startTime=0;duration=0;toJSON(){return{name:this.name,entryType:this.entryType,startTime:this.startTime,duration:this.duration}}},PerformanceObserverEntryListStub=class{getEntries(){return[]}getEntriesByName(e){return[]}getEntriesByType(e){return[]}};const t=globalThis.PerformanceObserver||PerformanceObserverStub,n=globalThis.PerformanceEntry||PerformanceEntryStub,r=globalThis.PerformanceObserverEntryList||PerformanceObserverEntryListStub,i=globalThis.PerformanceMark||class extends PerformanceEntryStub{},a=globalThis.PerformanceMeasure||class extends PerformanceEntryStub{};function eventLoopUtilization(e,t){return{idle:0,active:0,utilization:0}}function timerify(t){let wrapped=function(...n){let r=e.now(),i=t.apply(this,n);return e.now()-r,i};return Object.defineProperty(wrapped,`name`,{value:t.name}),wrapped}function monitorEventLoopDelay(e){let t=new Map;return{enable(){},disable(){},reset(){},percentile(e){return 0},get min(){return 0},get max(){return 0},get mean(){return 0},get stddev(){return 0},get percentiles(){return t}}}var o={performance:e,PerformanceObserver:t,PerformanceEntry:n,PerformanceObserverEntryList:r,PerformanceMark:i,PerformanceMeasure:a,eventLoopUtilization,timerify,monitorEventLoopDelay};export{n as PerformanceEntry,i as PerformanceMark,a as PerformanceMeasure,t as PerformanceObserver,r as PerformanceObserverEntryList,o as default,eventLoopUtilization,monitorEventLoopDelay,e as performance,timerify};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/perf_hooks",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Node.js perf_hooks module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"perf_hooks"
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@gjsify/cli": "^0.3.
|
|
34
|
-
"@gjsify/unit": "^0.3.
|
|
33
|
+
"@gjsify/cli": "^0.3.21",
|
|
34
|
+
"@gjsify/unit": "^0.3.21",
|
|
35
35
|
"@types/node": "^25.6.2",
|
|
36
36
|
"typescript": "^6.0.3"
|
|
37
37
|
}
|