-
Notifications
You must be signed in to change notification settings - Fork 397
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
enhancement request: putting expressions/functions outside data
#1996
Comments
I remember this one before, and I resorted to using computed props. There was also an example of helper functions in Here's the related issue: #956 (more than a thousand issues ago) |
Yeah, it has come up once or twice (gawd, more than a thousand issues? Get ready to party like it's #1999) - I can understand where you're coming from @dagnelies. It is something that you can do by adding helper functions to the prototype, but it could be more intuitive. I don't think it'll make it into 0.8 (want to limit the scope of that release), but consider it on the radar. |
I just wanted to toss in my two cents that I'd like to keep the ability to have functions in the data intact because it can be pretty handy to swap out functionality (sorting, side-effecting - for shame, I know -, etc) from the viewmodel. I have been planning to experiment with something more akin to filters from other template systems, where the filter fn that lives outside the data is called with the Ractive instance as the context and the data as the first param, to see how that plays out. |
I think with access to |
out of curiosity, what's |
It's like |
thanks for the info. Btw, good work. |
So how to use this? something like |
@kouts, no it's only reachable in a ractive-observable way: UPDATE: not sure how, but I typoed |
Hi,
This is a humble request / vote to put expression functions outside
data
in the long term.There are several reasons for this:
...this is of course not dramatic, simply putting the data in a specific place does the trick, but i still think keeping only data in
data
would be nicer.So where would I put the functions? Ideally, I'd put them anywhere in the root, or in a predefined place like
functions
orexpr
, whatever.The text was updated successfully, but these errors were encountered: