File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React from 'react';
22import ReactDOM from 'react-dom/client' ;
33import App from './components/App/App' ;
44import { uiStateHelper } from './contexts/UIStateContext' ;
5- import { spector2 as capture } from '../capture' ;
5+ import { spector2 as capture , spector2 } from '../capture' ;
66
77let initialized = false ;
88
@@ -24,17 +24,28 @@ export async function captureFrame() {
2424 uiStateHelper . addTrace ( trace ) ;
2525}
2626
27+ export function startCapture ( ) {
28+ if ( spector2 . tracing ) {
29+ throw new Error ( 'already tracing' ) ;
30+ }
31+ spector2 . startTracing ( ) ;
32+ }
33+
34+ export async function endCapture ( ) {
35+ if ( ! spector2 . tracing ) {
36+ throw new Error ( 'not tracing' ) ;
37+ }
38+ const trace = spector2 . endTracing ( ) ;
39+ uiStateHelper . addTrace ( trace ) ;
40+ }
41+
2742init ( ) ;
2843uiStateHelper . registerAPI ( {
2944 playTo ( replay , id ) {
3045 // TBD: reply the given 'replay' to the specified id
3146 console . log ( replay , id ) ;
3247 } ,
33- startCapture ( ) {
34- // TBD: Capture until stop capture is called
35- } ,
36- endCapture ( ) {
37- // TBD: Stop Capturing
38- } ,
48+ startCapture,
49+ endCapture,
3950 captureFrame,
4051} ) ;
You can’t perform that action at this time.
0 commit comments