Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: respond to arrival of multiple elements #66

Open
praxiq opened this issue Mar 21, 2018 · 3 comments
Open

Feature request: respond to arrival of multiple elements #66

praxiq opened this issue Mar 21, 2018 · 3 comments

Comments

@praxiq
Copy link

praxiq commented Mar 21, 2018

I'm writing code that should run when two specific elements both exist. They could be created in any order. I'd like to do something like this:

document.arrive(['.first', '.second'], function() { ... })

or perhaps this:

document.arrive({first: '.first', second:'.second'}, function() { 
  const first = this.first; 
  const second = this.second;
})

Any interest in adding this sort of thing, or is there a straightforward workaround?

@uzairfarooq
Copy link
Owner

Interesting. How would it behave in case of multiple .first, .second elements? With single element like this document.arrive('.elem', function() {}) it keeps on firing whenever an element is added to DOM.

@jsabrooke
Copy link

I wanted this too, but that's a good point @uzairfarooq! I guess at least in an initial implementation, it would only ever fire once? Might be a bit unclear though...

@mattvb91
Copy link

mattvb91 commented Sep 3, 2022

Is there any way to achieve this? currently looking for exactly this too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants