performanceObserverEntryList.getEntriesByName(name[, type])
添加于:v8.5.0
参数
name
<string>type
<string>- 返回: <PerformanceEntry[]>
返回 PerformanceEntry
对象列表,按时间顺序相对于 performanceEntry.startTime
其 performanceEntry.name
等于 name
,并且可选地,其 performanceEntry.entryType
等于 type
。
const {
performance,
PerformanceObserver
} = require('node:perf_hooks');
const obs = new PerformanceObserver((perfObserverList, observer) => {
console.log(perfObserverList.getEntriesByName('meow'));
/**
* [
* PerformanceEntry {
* name: 'meow',
* entryType: 'mark',
* startTime: 98.545991,
* duration: 0
* }
* ]
*/
console.log(perfObserverList.getEntriesByName('nope')); // []
console.log(perfObserverList.getEntriesByName('test', 'mark'));
/**
* [
* PerformanceEntry {
* name: 'test',
* entryType: 'mark',
* startTime: 63.518931,
* duration: 0
* }
* ]
*/
console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
performance.clearMarks();
performance.clearMeasures();
observer.disconnect();
});
obs.observe({ entryTypes: ['mark', 'measure'] });
performance.mark('test');
performance.mark('meow');
相关用法
- Node.js PerformanceObserverEntryList.getEntriesByType(type)用法及代码示例
- Node.js PerformanceObserverEntryList.getEntries()用法及代码示例
- Node.js Process uncaughtException用法及代码示例
- Node.js Process multipleResolves用法及代码示例
- Node.js MySQL POSITION()用法及代码示例
- Node.js Process exit用法及代码示例
- Node.js Process beforeExit用法及代码示例
- Node.js Process unhandledPromiseRejection用法及代码示例
- Node.js Process message用法及代码示例
- Node.js PNG转JPG用法及代码示例
- Node.js Process warning用法及代码示例
- Node.js ServerHttp2Stream http2stream.pushStream(headers[, options], callback)用法及代码示例
- Node.js http2.Http2ServerRequest request.url用法及代码示例
- Node.js request.socket用法及代码示例
- Node.js assert.notEqual(actual, expected[, message])用法及代码示例
- Node.js tlsSocket.authorized用法及代码示例
- Node.js zlib.deflateRaw()用法及代码示例
- Node.js http.IncomingMessage message.rawHeaders用法及代码示例
- Node.js Console用法及代码示例
- Node.js GM transparent()用法及代码示例
- Node.js URL.protocol用法及代码示例
- Node.js http.Agent.reuseSocket(socket, request)用法及代码示例
- Node.js fs.filehandle.datasync()用法及代码示例
- Node.js socket.bind()用法及代码示例
- Node.js v8.getHeapSpaceStatistics()用法及代码示例
注:本文由纯净天空筛选整理自nodejs.org大神的英文原创作品 PerformanceObserverEntryList.getEntriesByName(name[, type])。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。