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

Documentation for shouldBind option on ractive.get() #92

Open
lazylester opened this issue Aug 14, 2017 · 4 comments
Open

Documentation for shouldBind option on ractive.get() #92

lazylester opened this issue Aug 14, 2017 · 4 comments

Comments

@lazylester
Copy link
Contributor

I have discovered an undocumented "shouldBind" option on the ractive.get() method. Turns out I needed this option to solve a problem with unexpected ractive behaviour (ref: this stack overflow question.

Assuming that this option is intended to be available in the public api (is it? I hope so b/c it solved my problem!), would it be possible, please, to provide documentation?

I would offer a PR except I don't really understand the intent of the shouldBind option, just its effect.

@evs-chris
Copy link
Contributor

It's not intended to be part of the public API, unfortunately. It's intended for internal use so that cross-instance mappings can bind their root functions to the correct instance. Basically, if a function appears at the root of ractive data, it is automatically bound. If you want to avoid binding, put functions in a nested keypath.

We could add an escape hatch for that, but up to this point, it's been unnecessary.

@lazylester
Copy link
Contributor Author

@evs-chris can I prevail upon you, please, to look at my stack overflow question (referenced above). I ran into some unexpected behaviour which was nicely solved with the shouldBind option.

If shouldBind is not part of the public api, do you have any other suggestion for solving my SO problem? Or should I open an issue to solve it? Forgive me if you have explained how to solve it above, your explanation of shouldBind was hard for me to understand.

@evs-chris
Copy link
Contributor

I took a stab at it on SO, but I'm not certain it's any better 😄

@lazylester
Copy link
Contributor Author

That helps a lot, Chris. Your help is very much appreciated. Thank you. From your SO response I was able to solve the problem in my app (and bump your SO rep!).

Should I leave this issue open as a reminder to document this binding behaviour? Or should I close it?

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