diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/system.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils/system.ts b/src/utils/system.ts index 2e9fa4a..8ccb5d1 100644 --- a/src/utils/system.ts +++ b/src/utils/system.ts @@ -76,6 +76,7 @@ export const bindCurrentTime = ( return bind(time); }; +const monitors = new Set(); export const monitorDirectory = ( path: string, callback: ( @@ -102,5 +103,9 @@ export const monitorDirectory = ( } } + // Keep ref to monitor so it doesn't get GCed + monitors.add(monitor); + monitor.connect("notify::cancelled", () => monitor.cancelled && monitors.delete(monitor)); + return monitor; }; |