mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib: refactor to use validateCallback
PR-URL: https://github.com/nodejs/node/pull/36609 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
8cf5ae07e9
commit
b00bb01db9
20 changed files with 114 additions and 125 deletions
|
@ -56,7 +56,6 @@ const L = require('internal/linkedlist');
|
|||
const kInspect = require('internal/util').customInspectSymbol;
|
||||
|
||||
const {
|
||||
ERR_INVALID_CALLBACK,
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
ERR_INVALID_ARG_VALUE,
|
||||
ERR_VALID_PERFORMANCE_ENTRY_TYPE,
|
||||
|
@ -68,6 +67,8 @@ const {
|
|||
kHandle,
|
||||
} = require('internal/histogram');
|
||||
|
||||
const { validateCallback } = require('internal/validators');
|
||||
|
||||
const { setImmediate } = require('timers');
|
||||
const kCallback = Symbol('callback');
|
||||
const kTypes = Symbol('types');
|
||||
|
@ -341,9 +342,7 @@ class PerformanceObserverEntryList {
|
|||
|
||||
class PerformanceObserver {
|
||||
constructor(callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
throw new ERR_INVALID_CALLBACK(callback);
|
||||
}
|
||||
validateCallback(callback);
|
||||
ObjectDefineProperties(this, {
|
||||
[kTypes]: {
|
||||
enumerable: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue