Serabe / ember-bind-helper

Add a bind helper to bind a function to a context

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ability to bind without runloop

mehulkar opened this issue · comments

I'm in a situation where I want to bind a context to a function, and this addon is perfect for that, but the function will be run synchronously, so it might overkill to use run.bind.

Maybe it should be possible to bind this context without involving the runloop?

What would be the usage (example) and the API proposal?

If a major version upgrade is possible, then changing the existing helper to {{run-bind}} and adding a new one called {{bind}} would work. Or if we want to add to the existing API surface, something like {{bind runloop=false}} could work?

I don't have a strong opinion.

I think we could detect that we are operating in Ember 3.4+ and avoid run.bind (Ember 3.4 drops the autorun assertion), might still need to be a major bump but it seems like a good path forward to me...

Uhm, I thought the autorun assertion was dropped after 3.4. Given that 3.4 is the latest LTS and 2.18 support was dropped last month, I'm inclined on a mayor bump and dropping run.bind unconditionally. Adding a comment on the README to pin the version if running in an older version

@mehulkar are you in 3.4+?

What do you think, @rwjblue?

Seems good. (But it was dropped in 3.4 (see changelog entry))

@rwjblue @mehulkar #13

If you are 👍 I'll merge and release ember-bind-helper@1.0.0, now runloop-free.

Also opened #14, when both are merged, I'll do the release.

Yep I’m on 3.4+, thanks!

@mehulkar 1.0 was released.

I refactored that part as well. Now it is a class. Let me know if something is not clear.