File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed
Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 99// backup_project: (async () => {}),
1010// restore_project: (async () => ""),
1111// run_project: (async () => {}),
12+ // log: (async () => {}),
1213// }
1314// }
Original file line number Diff line number Diff line change @@ -176,9 +176,12 @@ const createAppDataContext = () => {
176176
177177 const existingId = await loadExistingId ( ) ;
178178 setProjectId ( existingId ) ;
179+
179180 if ( isDesktop ( ) ) {
180181 const restoredProject = await getRestoredProject ( ) ;
181- saveData ( `p:${ existingId } ` , restoredProject ) ;
182+ if ( restoredProject ) {
183+ saveData ( `p:${ existingId } ` , restoredProject ) ;
184+ }
182185 }
183186
184187 await loadProject (
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export interface PyWebview {
1212 backup_project : ( content : string ) => Promise < boolean > ;
1313 restore_project : ( ) => Promise < string > ;
1414 run_project : ( script : string ) => Promise < void > ;
15+ log : ( message : string ) => Promise < void > ;
1516 }
1617}
1718
Original file line number Diff line number Diff line change @@ -117,6 +117,12 @@ const setupDesktopTools = () => {
117117 return getApi ( ) ! . run_project ( script ) ;
118118 }
119119
120+ const log = async ( message : string ) : Promise < void > => {
121+ if ( ! isDesktop ( ) ) return ;
122+ await waitForPWV ( ) ;
123+ return getApi ( ) ! . log ( message ) ;
124+ }
125+
120126 return {
121127 isDesktop,
122128 closeWindow,
@@ -127,6 +133,7 @@ const setupDesktopTools = () => {
127133 backupProject,
128134 getRestoredProject,
129135 runProject,
136+ log,
130137 }
131138} ;
132139
@@ -140,5 +147,6 @@ export const {
140147 backupProject,
141148 getRestoredProject,
142149 runProject,
150+ log,
143151} = setupDesktopTools ( ) ;
144152
You can’t perform that action at this time.
0 commit comments