This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="about"> | |
| <video controls type="video/mp4" :src="videoObjectURL"></video> | |
| <button @click="loadVideo">Load Video</button> | |
| <button @click="cacheVideo">Cache Video</button> | |
| <button @click="deleteVideo">Delete Video</button> | |
| </div> | |
| </template> | |
| <script setup lang="ts"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useReducer } from "react"; | |
| import "./App.css"; | |
| const initialState = { count: 0, str: "" }; | |
| type ActionTypes = | |
| { | |
| type: "increment"; | |
| payload: { num: number }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User { | |
| userId: number = 0 | |
| userName: string = "" | |
| } | |
| const user1: User = { | |
| userId: 1, | |
| userName: "user1" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function asyncSetTimeout(msec, func = () => {}){ | |
| let timeoutId | |
| let r | |
| const exec = () => new Promise((res) => { | |
| r = res | |
| timeoutId = setTimeout(async () => { | |
| timeoutId = null | |
| await func() | |
| res() |