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

Define initial plugin standard #212

Open
montlebalm opened this issue Dec 21, 2014 · 1 comment
Open

Define initial plugin standard #212

montlebalm opened this issue Dec 21, 2014 · 1 comment

Comments

@montlebalm
Copy link
Member

As an F2 developer, I want to know how plugins work, so I can extend the library in a supported fashion.

Currently plugins exist as an idea in F2. We've talked about writing them and have loosely described how they might be achieved. I think it's time to start thinking about what they actually look like and how developers should be allowed to extend the library.

1. No formal system

The simplest way of extending the library is to add to or replace the API directly. For instance, any developer can write:

F2.UI.Modals.alert = function(message, callback) {
  // Custom modal
}

This approach doesn't require any code changes on our part. We'd be leaving it up to each plugin developer to choose their own implementation.

When F2 is on the window, plugins can target it easily on load. However, sites that use a module system like AMD or CommonJS will need to pass an F2 reference to the plugin.

2. Exposed config

An alternative to the wild wild west approach above is to specify which pieces of the library we approve of replacing. This could be achieved during F2's instantiation. For instance:

F2.init({
  ui: {
    alert: function(message, callback) {
      // Custom modal
    }
  }
});

This would require some work on our part, but would make it clear which parts of the library are meant to be extended.

Which method do we prefer? Do use 1 for new functionality and 2 to replace existing methods? We should consider our options and test our decision out on #209.

@montlebalm montlebalm added this to the 1.5.0 milestone Dec 21, 2014
@markhealey
Copy link
Member

If we need an established convention, remember No. 2 above ("Exposed Config") is how F2 handles it currently. See F2.ContainerConfig. Also need to review #121.

@brianbaker brianbaker removed this from the 1.5.0 milestone Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants