1
0
Sven Fehler 1 жил өмнө
parent
commit
a6de2c82f0
1 өөрчлөгдсөн 5 нэмэгдсэн , 5 устгасан
  1. 5 5
      README.md

+ 5 - 5
README.md

@@ -86,18 +86,18 @@ Calling onSelector() before `DOMContentLoaded` is fired will not throw an error,
 document.addEventListener("DOMContentLoaded", initOnSelector);
 
 // Continuously checks if `div` elements are added to the DOM, then returns all of them (even previously detected ones) in a NodeList
-onSelector("div", {
-  listener: (element) => {
-    console.log("Elements found:", element);
+onSelector<HTMLDivElement>("div", {
+  listener: (elements) => {
+    console.log("Elements found:", elements); // type = NodeListOf<HTMLDivElement>
   },
   all: true,
   continuous: true,
 });
 
 // Checks if an input element with a value attribute of "5" is added to the DOM, then returns it and deregisters the listener
-onSelector("input[value=\"5\"]", {
+onSelector<HTMLInputElement>("input[value=\"5\"]", {
   listener: (element) => {
-    console.log("Element found:", element);
+    console.log("Element found:", element); // type = HTMLInputElement
   },
 });
 ```