Skip to content

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

@sp00x

Description

@sp00x

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 })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions