@@ -141,7 +141,7 @@ function stop_server!()
141
141
if ! isnothing (SESSION[])
142
142
if Base. isopen (SESSION[])
143
143
@info " Close running session..."
144
- close (SESSION[])
144
+ close_session (SESSION[])
145
145
end
146
146
SESSION[] = nothing
147
147
end
@@ -151,6 +151,41 @@ function stop_server!()
151
151
end
152
152
end
153
153
154
+ function close_session (session)
155
+ if Base. isopen (session)
156
+ on_session_close = js """
157
+ // Create a semi-transparent overlay
158
+ const overlay = document .createElement (' div' );
159
+ overlay .style .position = ' fixed' ;
160
+ overlay .style .top = ' 0' ;
161
+ overlay .style .left = ' 0' ;
162
+ overlay .style .width = ' 100%' ;
163
+ overlay .style .height = ' 100%' ;
164
+ overlay .style .backgroundColor = ' rgba(0, 0, 0, 0.7)' ; // Semi-transparent black
165
+ overlay .style .zIndex = ' 1000' ; // Ensure it's on top of everything
166
+ document .body .appendChild (overlay);
167
+
168
+ // Create the message element
169
+ const message = document .createElement (' div' );
170
+ message .textContent = ' Session Closed' ;
171
+ message .style .position = ' fixed' ;
172
+ message .style .top = ' 50%' ;
173
+ message .style .left = ' 50%' ;
174
+ message .style .transform = ' translate(-50%, -50%)' ;
175
+ message .style .color = ' white' ;
176
+ message .style .fontSize = ' 2em' ;
177
+ message .style .zIndex = ' 1001' ; // Ensure it's on top of the overlay
178
+ message .style .textAlign = ' center' ;
179
+ overlay .appendChild (message);
180
+
181
+ // Optionally, prevent any interaction with the underlying elements
182
+ overlay .style .pointerEvents = ' auto' ;
183
+ """
184
+ Bonito. evaljs (session, on_session_close)
185
+ close (session)
186
+ end
187
+ end
188
+
154
189
function start_server! (restart= true )
155
190
if server_running () && ! restart
156
191
error (" Server already running" )
@@ -184,7 +219,7 @@ function get_webapp()
184
219
@info " New GUI Session started"
185
220
if ! isnothing (SESSION[]) && Base. isopen (SESSION[])
186
221
@info " Close previous session..."
187
- close (SESSION[])
222
+ close_session (SESSION[])
188
223
end
189
224
SESSION[] = session
190
225
0 commit comments