File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ onMounted(() => {
1818 store .value .executeLog = ({ logLevel , data = [] }: LogPayload ) => {
1919 ;(lunaConsole .value ?.[logLevel ] as any )?.(... data )
2020 }
21+ store .value .clearConsole = clearLunaConsole
2122})
2223
2324function clearLunaConsole() {
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ const mode = computed<OutputModes>({
3939
4040function reload() {
4141 previewRef .value ?.reload ()
42- // clearLunaConsole ()
42+ store . value . clearConsole ?. ()
4343}
4444
4545defineExpose ({ reload , previewRef })
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ export function useStore(
4949 dependencyVersion = ref ( Object . create ( null ) ) ,
5050 reloadLanguageTools = ref ( ) ,
5151 executeLog = ref ( ) ,
52+ clearConsole = ref ( ) ,
5253 } : Partial < StoreState > = { } ,
5354 serializedState ?: string ,
5455) : ReplStore {
@@ -391,6 +392,7 @@ export function useStore(
391392 getFiles,
392393 setFiles,
393394 executeLog,
395+ clearConsole,
394396 } )
395397 return store
396398}
@@ -447,6 +449,10 @@ export type StoreState = ToRefs<{
447449 * @param payload - payload of a console static method output
448450 */
449451 executeLog ?: ( payload : LogPayload ) => void
452+ /**
453+ * If you enabled "showConsole" and have a custom "console" then you must provide this function.
454+ */
455+ clearConsole ?: ( ) => void
450456} >
451457
452458export interface ReplStore extends UnwrapRef < StoreState > {
@@ -471,6 +477,7 @@ export interface ReplStore extends UnwrapRef<StoreState> {
471477 getFiles ( ) : Record < string , string >
472478 setFiles ( newFiles : Record < string , string > , mainFile ?: string ) : Promise < void >
473479 executeLog ?( payload : LogPayload ) : void
480+ clearConsole ?( ) : void
474481}
475482
476483export type Store = Pick <
@@ -496,6 +503,7 @@ export type Store = Pick<
496503 | 'getImportMap'
497504 | 'getTsConfig'
498505 | 'executeLog'
506+ | 'clearConsole'
499507>
500508
501509export class File {
You can’t perform that action at this time.
0 commit comments