File tree Expand file tree Collapse file tree 1 file changed +11
-21
lines changed Expand file tree Collapse file tree 1 file changed +11
-21
lines changed Original file line number Diff line number Diff line change @@ -458,34 +458,24 @@ Actions.init([
458
458
}
459
459
] ) ;
460
460
461
- // Debounce function
462
- function debounce ( func , wait ) {
463
- let timeout ;
464
- return function ( ...args ) {
465
- clearTimeout ( timeout ) ;
466
- timeout = setTimeout ( ( ) => func . apply ( this , args ) , wait ) ;
467
- } ;
468
- }
469
-
470
- // Function to send socket request
471
- function sendCheckSession ( ) {
472
- Crud . socket . send ( {
473
- method : 'checkSession' ,
474
- broadcast : false ,
475
- broadcastBrowser : false
476
- } ) ;
461
+ let checkSessionTimeout
462
+ function checkSession ( ) {
463
+ clearTimeout ( checkSessionTimeout ) ;
464
+ checkSessionTimeout = setTimeout ( function ( ) {
465
+ Crud . socket . send ( {
466
+ method : 'checkSession' ,
467
+ broadcast : false ,
468
+ broadcastBrowser : false
469
+ } ) ;
470
+ } , 500 ) ;
477
471
}
478
472
479
- // Create a debounced version of the sendCheckSession function
480
- const debouncedSendCheckSession = debounce ( sendCheckSession , 500 ) ; // Adjust the delay (in milliseconds) as needed
481
-
482
- // Initialize the observer
483
473
Observer . init ( {
484
474
name : 'CoCreateUserSessionAddedNodes' ,
485
475
observe : [ 'addedNodes' ] ,
486
476
target : '[session]' ,
487
477
callback : ( ) => {
488
- debouncedSendCheckSession ( ) ;
478
+ checkSession ( ) ;
489
479
}
490
480
} ) ;
491
481
You can’t perform that action at this time.
0 commit comments