File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 */
1818
1919// jshint ignore: start
20- /*globals __TAURI__*/
20+ /*globals*/
21+ const TAURI = window . __TAURI__ ;
2122
2223const TAURI_KEYS = {
2324 LAST_WINDOW_WIDTH : "tauri.LAST_WINDOW_WIDTH" ,
2425 LAST_WINDOW_HEIGHT : "tauri.LAST_WINDOW_HEIGHT"
2526} ;
2627
27- const appWindow = __TAURI__ . window . appWindow ;
28+ const appWindow = TAURI && TAURI . window . appWindow ;
2829
2930function _setupWindowResizeListeners ( ) {
3031 appWindow . onResized ( async ( { payload : size } ) => {
@@ -40,7 +41,7 @@ async function positionWindow() {
4041 const phoenixAspectRatio = 1.6 , // phoenix looks good in aspect ratio 1.6w:1h
4142 minWidth = 800 ,
4243 minHeight = 600 ;
43- let monitorSize = ( await __TAURI__ . window . currentMonitor ( ) ) . size ,
44+ let monitorSize = ( await TAURI . window . currentMonitor ( ) ) . size ,
4445 targetWindowHeight = monitorSize . height * 2 / 3 ,
4546 targetWindowWidth = targetWindowHeight * phoenixAspectRatio ;
4647 let targetHeight = parseInt ( localStorage . getItem ( TAURI_KEYS . LAST_WINDOW_HEIGHT ) || `${ targetWindowHeight } ` ) ,
@@ -57,7 +58,7 @@ async function positionWindow() {
5758 if ( targetWidth < minWidth ) {
5859 targetWidth = minWidth ;
5960 }
60- await appWindow . setSize ( new __TAURI__ . window . PhysicalSize ( targetWidth , targetHeight ) ) ;
61+ await appWindow . setSize ( new TAURI . window . PhysicalSize ( targetWidth , targetHeight ) ) ;
6162 _setupWindowResizeListeners ( ) ;
6263}
6364
You can’t perform that action at this time.
0 commit comments