-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (36 loc) · 967 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const React = require('react');
const ReactDOM = require('react-dom');
let multiREGL;
try {
multiREGL = require('multi-regl')();
} catch(e) {}
class ReglComponent extends React.Component {
componentDidMount() {
if (super.componentDidMount) {
super.componentDidMount();
}
const node = ReactDOM.findDOMNode(this);
this.initialize(multiREGL, node, this.props);
}
initialize() {
// console.warn('initialize() not defined on ReglComponent.');
}
update() {
// console.warn('update() not defined on ReglComponent.');
}
componentWillReceiveProps(nextProps) {
this.update(nextProps);
}
shouldComponentUpdate() {
return false;
}
render() {
let { className, style, onClick } = this.props;
className = (className ? className : '') + ' regl';
return React.createElement('div', { className, style, onClick });
}
}
ReglComponent.defaultProps = {
className: ''
};
module.exports = ReglComponent;