Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-10926: updated plugin registry documentation #1452

Merged
merged 2 commits into from
Jul 17, 2018

Conversation

lieut-data
Copy link
Member

Summary

This set of changes supports the automatic extraction of the plugin registry for documentation purposes.

Ticket Link

https://mattermost.atlassian.net/browse/MM-10926

Checklist

  • Ran make check-style to check for style errors (required for all pull requests)
  • Ran make test to ensure unit and component tests passed
  • Added or updated unit tests (required for all new features)

registerPlugin, to avoid encouraging direct manipulation of the
window.plugins global.

rninitialize, to match the use of unregister (vs. deregister) elsewhere.
//
// During the beta, plugins manipulated the global window.plugins data structure directly. This
// remains possible, but is officially deprecated and may be removed in a future release.
function registerPlugin(id, plugin) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on pre-release.

plugin.uninitialize();

// Support the deprecated deinitialize callback from the plugins beta.
} else if (plugin && plugin.deinitialize) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supporting deinitialize, but we've converged on un elsewhere so this made sense for consistency.

@@ -35,32 +35,32 @@ export default class PluginRegistry {

// Register a component at the root of the channel view of the app.
// Accepts a React component. Returns a unique identifier.
registerRootComponent = (component) => {
registerRootComponent(component) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binding the functions using arrow functions wasn't necessary, since we weren't using these callbacks out of context (e.g. as an event handler). This change allows me to use esprima to parse out this file and generate automated documentation.

Copy link
Member

@jwilander jwilander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crspeller crspeller merged commit a13e00f into master Jul 17, 2018
@crspeller crspeller deleted the mm-10926-updated-plugin-registry-documentation branch July 17, 2018 01:38
@lindalumitchell lindalumitchell added the Tests/Not Needed Does not require new release tests label Jul 17, 2018
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Jul 21, 2018
fincha pushed a commit to fincha/mattermost-webapp that referenced this pull request Oct 21, 2018
* MM-10926: avoid arrow functions on registry to work with esprima

* MM-10926: introduce registerPlugin and uninitialize

registerPlugin, to avoid encouraging direct manipulation of the
window.plugins global.

rninitialize, to match the use of unregister (vs. deregister) elsewhere.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2: Dev Review Requires review by a core commiter Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation Tests/Not Needed Does not require new release tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants