Skip to content

Commit

Permalink
provide web impl
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Nov 20, 2024
1 parent 2578654 commit 0494c31
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type performance from 'react-native-performance';
import {createModuleProxy, OptionalDependencyNotInstalledError} from './ModuleProxy';
import {createModuleProxy, OptionalDependencyNotInstalledError} from '../ModuleProxy';

const PerformanceProxy = createModuleProxy<typeof performance>(() => {
try {
Expand Down
2 changes: 2 additions & 0 deletions lib/dependencies/PerformanceProxy/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Use the existing performance API on web
export default performance;
3 changes: 1 addition & 2 deletions lib/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type * as performance from 'react-native-performance';
import PerformanceProxy from './dependencies/PerformanceProxy';

const decoratedAliases = new Set();

/**
* Capture a measurement between the start mark and now
*/
function measureMarkToNow(startMark: performance.PerformanceMark, detail: Record<string, unknown>) {
function measureMarkToNow(startMark: PerformanceMark, detail: Record<string, unknown>) {
PerformanceProxy.measure(`${startMark.name} [${startMark.detail.args.toString()}]`, {
start: startMark.startTime,
end: PerformanceProxy.now(),
Expand Down

0 comments on commit 0494c31

Please sign in to comment.