Skip to content

Commit

Permalink
fix: expose performance constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jan 23, 2024
1 parent 06565ad commit 4570d78
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/integration-tests/test/global.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test('performance', () => {
expect(performance.now()).toBeGreaterThan(0)
})
1 change: 1 addition & 0 deletions packages/primitives/src/primitives/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function load(scopedContext = {}) {
TextDecoderStream,
atob,
btoa,
performance,
})

/** @type {import('../../type-definitions/console')} */
Expand Down
1 change: 1 addition & 0 deletions packages/primitives/type-definitions/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from './text-encoding-streams'
export * from './structured-clone'
export * from './url'
export * from './timers'
export * from './performance'
2 changes: 2 additions & 0 deletions packages/primitives/type-definitions/performance.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const performanceConstructor: typeof performance
export { performanceConstructor as performance }
3 changes: 3 additions & 0 deletions packages/vm/src/edge-vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ function addPrimitives(context: VMContext) {
// Console
'console',

// Performance
'performance',

// Timers
'setTimeout',
'setInterval',
Expand Down

0 comments on commit 4570d78

Please sign in to comment.