File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ export class PluginController {
4747 private static steamController : SteamController ;
4848
4949 private static onWakeSub : Unregisterer ;
50-
50+ static isDismounted : boolean ;
51+
5152 /**
5253 * Sets the plugin's serverAPI.
5354 * @param server The serverAPI to use.
@@ -131,6 +132,7 @@ export class PluginController {
131132 * Function to run when the plugin dismounts.
132133 */
133134 static dismount ( ) : void {
135+ this . isDismounted = true ;
134136 if ( this . onWakeSub ) this . onWakeSub . unregister ( ) ;
135137
136138 this . tabMasterManager . disposeReactions ( ) ;
Original file line number Diff line number Diff line change 11import { FileSelectionType , ServerAPI } from "decky-frontend-lib" ;
22import { validateTabs } from "../Utils" ;
33import { TabProfileDictionary } from '../../state/TabProfileManager' ;
4+ import { PluginController } from './PluginController' ;
45
56/**
67 * Class for frontend -> backend communication.
@@ -326,16 +327,17 @@ export class PythonInterop {
326327 * @param message The message of the toast.
327328 */
328329 static toast ( title : string , message : string ) : void {
329- return ( ( ) => {
330+ setTimeout ( ( ) => {
331+ if ( PluginController . isDismounted ) return ;
330332 try {
331- return this . serverAPI . toaster . toast ( {
333+ this . serverAPI . toaster . toast ( {
332334 title : title ,
333335 body : message ,
334336 duration : 8000 ,
335337 } ) ;
336338 } catch ( e ) {
337339 console . log ( "Toaster Error" , e ) ;
338340 }
339- } ) ( ) ;
341+ } , 200 )
340342 }
341343}
You can’t perform that action at this time.
0 commit comments