Skip to content

Commit

Permalink
proper typings for performance.node
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Mar 20, 2023
1 parent dd3f8f4 commit bb79d0e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions performance.node.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import { performance } from 'node:perf_hooks'
import { nop } from './function.js'
import * as time from './time.js'

/**
* @type {typeof performance.measure}
*/
/* c8 ignore next */
export const measure = performance.measure ? performance.measure.bind(performance) : nop
export const measure = performance.measure ? performance.measure.bind(performance) : /** @type {any} */ (nop)

/**
* @type {typeof performance.now}
*/
/* c8 ignore next */
export const now = performance.now ? performance.now.bind(performance) : nop
export const now = performance.now ? performance.now.bind(performance) : time.getUnixTime

/**
* @type {typeof performance.mark}
*/
/* c8 ignore next */
export const mark = performance.mark ? performance.mark.bind(performance) : nop
export const mark = performance.mark ? performance.mark.bind(performance) : /** @type {any} */ (nop)

0 comments on commit bb79d0e

Please sign in to comment.