Преглед на файлове

fix: delete selectors entry if array empty

Sven преди 1 година
родител
ревизия
969d157585
променени са 3 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 2 0
      lib/SelectorObserver.ts
  2. 1 1
      test/TestScript
  3. 1 1
      tsconfig.json

+ 2 - 0
lib/SelectorObserver.ts

@@ -74,6 +74,8 @@ export class SelectorObserver {
               this.listenerMap.get(selector)!.splice(this.listenerMap.get(selector)!.indexOf(options), 1);
           }
         }
+        if(this.listenerMap.get(selector)?.length === 0)
+          this.listenerMap.delete(selector);
       }
     }
   }

+ 1 - 1
test/TestScript

@@ -1 +1 @@
-Subproject commit 31cf8d32d3991a0d5de924a37f9aada130c3712a
+Subproject commit 9275eeeb8e28a469a0e4796a7d0d9441c865f80f

+ 1 - 1
tsconfig.json

@@ -18,5 +18,5 @@
     "strict": true,
     "useDefineForClassFields": true
   },
-  "exclude": ["**/*.js", "dist/**", "tools/**"]
+  "exclude": ["**/*.js", "dist/**", "tools/**", "test/**"]
 }