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

Separate scopes / do not pollute global "rivets" configuration #736

Open
sp00x opened this issue Feb 25, 2021 · 0 comments
Open

Separate scopes / do not pollute global "rivets" configuration #736

sp00x opened this issue Feb 25, 2021 · 0 comments

Comments

@sp00x
Copy link

sp00x commented Feb 25, 2021

This may just be something I am not seeing, but is there a way of creating different scopes that do not share the same "rivets" object?

I.e. I do not see a way of having 2 separate views with different formatters bound to them, as they are all registered on the same "rivets" object,

E.g.
rivets.formatters.gt = (a,b) => a > b;
becomes available in all bindings/views, as far as I can tell?

I want isolated views that are not "polluted" with formatters and other options set on other views, as there could be configurations sourced from separate parties on the same page.

E.g. if I could do let scope1 = new rivets(); scoped.formatters.gt = ...

Is this not possible?

Maybe if this was possible to configure on the rivets.bind(el, data, ...local config...) ?

In Handlebars you can do: template({ ..data.. }, { helpers: { gt: (a,b) => a > b })

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

1 participant