Skip to content
This repository was archived by the owner on Jun 9, 2022. It is now read-only.
This repository was archived by the owner on Jun 9, 2022. It is now read-only.

Introduce module.root #44

@wilsonpage

Description

@wilsonpage

I'm proposing we set a new reference on each module with a view, this would be referred to as root. this.root would refer to the outermost module in the view hierarchy.

This seems like a simple thing, but opens up a whole host of communication options. Modules are now able to listen to events that happen on the root module (the single point of contact with our app).

this.root.on('themechange', function(type) {
  this.classList.remove(this.theme);
  this.classList.add(this.theme = type);
});

then...

view.fire('themechange', 'dark');

More controversially this could be used to set a single shared models across multiple modules, if need be.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions