Skip to content

Commit 091e7aa

Browse files
committed
added record code and states
1 parent 661291a commit 091e7aa

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

src/App.js

+26-20
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
import logo from './logo.svg';
2-
import './App.css';
1+
import logo from "./logo.svg";
2+
import "./App.css";
33

44
function App() {
5-
return (
6-
<div className="App">
7-
<header className="App-header">
8-
<img src={logo} className="App-logo" alt="logo" />
9-
<p>
10-
Edit <code>src/App.js</code> and save to reload.
11-
</p>
12-
<a
13-
className="App-link"
14-
href="https://reactjs.org"
15-
target="_blank"
16-
rel="noopener noreferrer"
17-
>
18-
Learn React
19-
</a>
20-
</header>
21-
</div>
22-
);
5+
const [code, setCode] = useState("");
6+
const [recording, setRecording] = useState(false);
7+
const [stream, setStream] = useState([]);
8+
const [startTime, setStartTime] = useState(null);
9+
const [isPlaying, setIsPlaying] = useState(false);
10+
11+
const [timeoutIds, setTimeoutIds] = useState([]);
12+
const inputRef = useRef();
13+
14+
const handleRecordStart = () => {
15+
if (recording) {
16+
console.log(stream);
17+
setRecording(false);
18+
return;
19+
}
20+
21+
inputRef.current.focus();
22+
setStartTime(Date.now());
23+
setStream([]);
24+
setCode("");
25+
setRecording(true);
26+
};
27+
28+
return <div className="App"></div>;
2329
}
2430

2531
export default App;

0 commit comments

Comments
 (0)