Skip to content

Commit

Permalink
This closes #22, avoid assigning the existing properties in Node.js o…
Browse files Browse the repository at this point in the history
…n the prototype chain (#23)
  • Loading branch information
peng authored Mar 20, 2024
1 parent 1bcf407 commit 73e5c9d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
if (typeof window === 'undefined') {
global.crypto = {
!global.crypto && (global.crypto = {
async getRandomValues(b) {
const { randomFillSync } = await import('crypto');
randomFillSync(b);
}
};
global.performance = {
});
!global.performance && (global.performance = {
now() {
const [sec, nsec] = process.hrtime();
return sec * 1000 + nsec / 1000000;
}
};
});
}
(() => {
const enosys = () => {
Expand Down

0 comments on commit 73e5c9d

Please sign in to comment.