From e24746d3a47ef9ee548c091b0b563165da3cf27d Mon Sep 17 00:00:00 2001 From: Dmitry Iv Date: Tue, 9 Jan 2024 09:42:41 -0500 Subject: [PATCH] Update readme.md --- readme.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 7e61d42..1930b9c 100644 --- a/readme.md +++ b/readme.md @@ -37,7 +37,7 @@ foo.remove(); Listens for connected/disconnected events for the list of elements. (alternative to [fast-on-load](https://www.npmjs.com/package/fast-on-load)) ```js -let nodes = [...document.querySelectorAll('.foo'), document.createElement('div')]; +const nodes = [...document.querySelectorAll('.foo'), document.createElement('div')]; // assign listener spect(nodes, el => { @@ -45,12 +45,11 @@ spect(nodes, el => { return () => console.log("disconnected"); }); -// modify DOM -document.body.appendChild(nodes.at(-1)) -// ... "connected" - nodes.at(-1).remove() // ... "disconnected" + +document.body.appendChild(nodes.at(-1)) +// ... "connected" ``` #### _spect\`selector\`_