Skip to content

Commit

Permalink
feat: add <Pluggable>
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Apr 8, 2018
1 parent f11f5c3 commit 79673e2
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/Pluggable/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {Component} from 'react';
import {h} from '../util';

export class Pluggable extends Component {
plugins = [];

constructor (props, context) {
super(props, context);
}

exec = (name) => {
const {plugins} = this.props;
let result;
let method = this.props[name];

if (method) {

}

for (let i = 0; i < plugins.length; i++) {
method = plugins[i][name];

if (!method) {
continue;
}

result = method(this);

if (result !== undefined) {
return result;
}
}
};

render () {

}
}

0 comments on commit 79673e2

Please sign in to comment.