Skip to content

Tangible Container #167

@montlebalm

Description

@montlebalm

I believe there could be both tangible and philosophical value in making the container a real object that is instantiated. Today, the Container is simply an idea representing the logic that loads Apps.

What if instead, we required Containers to be created like so:

require(['F2Container'], function(F2Container) {
  new F2Container({
    loadScripts: function() {},
    ui: {
      modal: function() {}
    }
  }, function(F2) {
    // F2.apps == app registry
    // F2.secretSauce == container only property

    // Container logic
  });
});

The gist is that you would instantiate F2Container and pass it your config and your container implementation. The library would instantiate a new version of F2 for you. This would allow us to localize configs in a multi-container solution. It also allows us to give containers special instances of F2 that have additional properties like an app registry. Previously, we've locked down similar functionality via tokens.

The last advantage is that it makes the Container a corporeal function we can point to when someone is learning the library.

My current thinking is that events would remain global, so any App could talk to any other App regardless of which container loaded them. I was thinking that the app registry would be localized to each container so different configs could be used to load different apps.

In conjunction with this, I think we should move towards a "no global" use of F2. Everyone wanting to make use of it would need to instantiate a controller or the F2Factory function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions