File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ import { Store, importMapFile } from '../store'
17
17
import { Props } from ' ../Repl.vue'
18
18
19
19
const props = defineProps <{ show: boolean ; ssr: boolean }>()
20
+ export type UpdateFlag = ' UPDATING' | ' SUCCESS' | ' FAILURE'
21
+ const emits = defineEmits <{
22
+ (e : ' update-preview' , flag : UpdateFlag ): UpdateFlag
23
+ }>()
20
24
21
25
const store = inject (' store' ) as Store
22
26
const clearConsole = inject (' clear-console' ) as Ref <boolean >
@@ -160,6 +164,7 @@ function createSandbox() {
160
164
}
161
165
162
166
async function updatePreview() {
167
+ emits (' update-preview' , ' UPDATING' )
163
168
if (import .meta .env .PROD && clearConsole .value ) {
164
169
console .clear ()
165
170
}
@@ -260,8 +265,10 @@ async function updatePreview() {
260
265
261
266
// eval code in sandbox
262
267
await proxy .eval (codeToEval )
268
+ emits (' update-preview' , ' SUCCESS' )
263
269
} catch (e : any ) {
264
270
runtimeError .value = (e as Error ).message
271
+ emits (' update-preview' , ' FAILURE' )
265
272
}
266
273
}
267
274
</script >
You can’t perform that action at this time.
0 commit comments