Summary: Plugins were loaded in `/plugins/index.js` which was loaded once at launch of the app. This moves the list of available plugins to redux. This way, plugins can be dynamically added. The redux store keeps to Maps of plugins (devicePlugins and clientPlugins) with their ID as key: ``` devicePlugins: Map<string, Class<FlipperDevicePlugin<>>>, clientPlugins: Map<string, Class<FlipperPlugin<>>>, ``` On launch of the app, all plugins bundled with the app and the one found in `pluginsPath` are dynamically added. This changes now allows to add new plugins at any time. All components that need to know which plugins are available (e.g. the sidebar) are connected to the redux store. This way, they will automatically update, whenever a new plugin is added. - add `plugins` to the redux store to keep the list of available plugins - add a plugins dispatcher, responsible for loading the plugins on launch - connecting all React components that imported `plugins/index.js` before to the redux store to get the plugins from there. - moved the updating of the MenuBar to the plugins dispatcher as it needs to update whenever a new plugin is added. Reviewed By: jknoxville, passy Differential Revision: D12449236 fbshipit-source-id: 6ef3e243e2c80443614b901ccbfde485fcb4301c
31 lines
813 B
JavaScript
31 lines
813 B
JavaScript
/**
|
|
* Copyright 2018-present Facebook.
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
* @format
|
|
*/
|
|
|
|
import androidDevice from './androidDevice';
|
|
import iOSDevice from './iOSDevice';
|
|
import windowsDevice from './windowsDevice';
|
|
import application from './application';
|
|
import tracking from './tracking';
|
|
import server from './server';
|
|
import notifications from './notifications';
|
|
import plugins from './plugins';
|
|
|
|
import type Logger from '../fb-stubs/Logger.js';
|
|
import type {Store} from '../reducers/index.js';
|
|
|
|
export default (store: Store, logger: Logger) =>
|
|
[
|
|
application,
|
|
androidDevice,
|
|
iOSDevice,
|
|
windowsDevice,
|
|
tracking,
|
|
server,
|
|
notifications,
|
|
plugins,
|
|
].forEach(fn => fn(store, logger));
|