This repository was archived by the owner on Jun 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ export class Cef {
215
215
return Cef . instances . get ( pid + "_" + browserId ) ;
216
216
}
217
217
static getInstances ( ) {
218
- return Cef . instances . values ( ) ;
218
+ return [ ... Cef . instances . values ( ) ] ;
219
219
}
220
220
}
221
221
Original file line number Diff line number Diff line change @@ -99,7 +99,9 @@ export function defineEvent<T extends object>(options: Options<T>) {
99
99
const pushedPos = length - 1 ;
100
100
101
101
const off = ( ) => {
102
- const currentMiddlewares = eventBus . get ( name ) || [ ] ;
102
+ const currentMiddlewares = eventBus . get ( name ) ;
103
+ if ( ! currentMiddlewares ) return ;
104
+
103
105
const currentMaxPos = currentMiddlewares . length - 1 ;
104
106
105
107
const endIdx = currentMaxPos < pushedPos ? currentMaxPos : pushedPos ;
@@ -111,6 +113,10 @@ export function defineEvent<T extends object>(options: Options<T>) {
111
113
}
112
114
}
113
115
116
+ if ( currentMiddlewares . length === 0 ) {
117
+ eventBus . delete ( name ) ;
118
+ }
119
+
114
120
return currentMiddlewares . length ;
115
121
} ;
116
122
@@ -120,7 +126,7 @@ export function defineEvent<T extends object>(options: Options<T>) {
120
126
const h = [ pusher , trigger ] as const ;
121
127
122
128
if ( isNative ) {
123
- identifier && samp . registerEvent ( name , identifier ) ;
129
+ typeof identifier !== "undefined" && samp . registerEvent ( name , identifier ) ;
124
130
samp . on ( name , trigger ) ;
125
131
}
126
132
You can’t perform that action at this time.
0 commit comments