[bug] new added node not listen on events via `eles.on()`
See original GitHub issueIssue type
Bug report
Environment info
- Cytoscape.js version : v3.5.1
- Browser/Node.js & version :
Current (buggy) behaviour
After a new node is added to the graph, events on e.g. cy.nodes().on('click')
are not executed, but are available via cy.on('click', 'node')
.
Desired behaviour
Listen on events after adding a new node to the graph via cy.nodes().on('click')
Minimum steps to reproduce
- Click on a node:
// console output
cy.nodes().on(click)
cy.on(click, node)
- Add new node via the button on top
- Click on new node
// console output
cy.on(cxttap, node)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >Node js event listener not working as expected - Stack Overflow
So im basically trying to emit and listen to a specific event on different typescript classes. The first event that is emitted is...
Read more >EventTarget.addEventListener() - Web APIs | MDN
It works on any event target, not just HTML or SVG elements. The method addEventListener() works by adding a function, or an object...
Read more >[bug?] Why can't capture the error in events #3882 - GitHub
If server.on('error' happened and error's code is EADDRINUSE , then it says that the port 80 is already used. In this scenario, reject(err) ......
Read more >Events | Node.js v19.3.0 Documentation
When a listener is registered using the eventEmitter.on() method, ... As a best practice, listeners should always be added for the 'error' events....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it is similar to JQuery
on
and the deprecatedlive
. https://api.jquery.com/live/.You are looking for that the
.nodes()
collection is always uptodate with the current nodes. However, as far I know it it is just a snapshot of the nodes at the moment you call.nodes()
.I’m not familiar with any tools that handle collections in an automatically updating way. How would that work with the set theory operations, or what if you wanted to diff an old set of nodes with a new set of nodes?
Where do you think would be the best place in the documentation to address your issue? Maybe
eles.on()
? Would you be open to writing a few sentences that would help to clarify things for people like you, who run into this issue?