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

Toggle: unbind event after partial fetched #94

Closed
fffx opened this issue Oct 1, 2019 · 3 comments
Closed

Toggle: unbind event after partial fetched #94

fffx opened this issue Oct 1, 2019 · 3 comments

Comments

@fffx
Copy link
Contributor

fffx commented Oct 1, 2019

Shouldn't we unbind the Event after partial fetched? I notice that the event still triggered and fetch the partial every time after the partial already be rendered.

In jquery we can achieve this by use namespace event, and in pure js we can use removeEventListener

I would like make PR if this is a bug?

@nikolalsvk
Copy link
Owner

I am not sure about unbinding the event, idea is to possibly toggle render_async as many times as you want. For example, maybe users want to do something like this:

<a href='#' id='reload-comments'>Reload</a>
<%= render_async comments_path, toggle: { selector: '#reload-comments', event: :click } %>

But, we can add a possibility to unbind the event if it's a problem for some folks. Leave 👍 if you'd like to see this in render_async

@Tab10id
Copy link

Tab10id commented Nov 9, 2019

For example, maybe users want to do something like this

I want it. I'd love to render some widget by additional request and rerender it when some event happened. For now I can achive this only by hack with container_id (I render wrapper with that id on renderred partial).

nikolalsvk added a commit that referenced this issue Nov 11, 2019
Add once option to remove event once it's triggered #94
@nikolalsvk
Copy link
Owner

This is solved in #96 and released in 2.1.4 version https://github.com/renderedtext/render_async/releases/tag/2.1.4

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

No branches or pull requests

3 participants