Skip to content

Commit

Permalink
[update] support plugins
Browse files Browse the repository at this point in the history
what:
why:
how:
  • Loading branch information
toxic-johann committed Aug 4, 2017
1 parent 2146cf4 commit 73dc77b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions __tests__/dispatcher/index.js
Expand Up @@ -193,6 +193,13 @@ describe('dispatcher', () => {
expect(dispatcher.readySync).toBe(true);
dispatcher.destroy();
});
test('support plugins too', () => {
const dispatcher = new Dispatcher({
wrapper: document.createElement('div'),
plugins: ['normalInstall']
}, {});
expect(dispatcher.plugins.normalInstall.__id).toBe('normalInstall');
});
});

describe('_getTopLevel', () => {
Expand Down
6 changes: 6 additions & 0 deletions src/dispatcher/index.js
Expand Up @@ -99,6 +99,12 @@ export default class Dispatcher {
this.videoConfigReady = false;
// create the videoconfig
this.videoConfig = new VideoConfig(this, config);
// support both plugin and plugins here as people often cofuse both
// $FlowFixMe: we support plugins here, which should be illegal
if(isArray(config.plugins) && !isArray(config.plugin)) {
config.plugin = config.plugins;
delete config.plugins;
}
this._initUserPlugin(config.plugin);
this.order.forEach(key => this.plugins[key].__init(this.videoConfig));
this.videoConfig.lockKernelProperty();
Expand Down

0 comments on commit 73dc77b

Please sign in to comment.