Make ReactWrapperView
globals explicit
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
/* global Backbone: false */
|
/* global Backbone: false */
|
||||||
|
/* global i18n: false */
|
||||||
// Additional globals used:
|
/* global React: false */
|
||||||
// window.React
|
/* global ReactDOM: false */
|
||||||
// window.ReactDOM
|
|
||||||
// window.i18n
|
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
(function () {
|
(function () {
|
||||||
@@ -26,8 +24,8 @@
|
|||||||
},
|
},
|
||||||
update(props) {
|
update(props) {
|
||||||
const updatedProps = this.augmentProps(props);
|
const updatedProps = this.augmentProps(props);
|
||||||
const element = window.React.createElement(this.Component, updatedProps);
|
const reactElement = React.createElement(this.Component, updatedProps);
|
||||||
window.ReactDOM.render(element, this.el);
|
ReactDOM.render(reactElement, this.el);
|
||||||
},
|
},
|
||||||
augmentProps(props) {
|
augmentProps(props) {
|
||||||
return Object.assign({}, props, {
|
return Object.assign({}, props, {
|
||||||
@@ -38,11 +36,11 @@
|
|||||||
}
|
}
|
||||||
this.remove();
|
this.remove();
|
||||||
},
|
},
|
||||||
i18n: window.i18n,
|
i18n,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
window.ReactDOM.unmountComponentAtNode(this.el);
|
ReactDOM.unmountComponentAtNode(this.el);
|
||||||
Backbone.View.prototype.remove.call(this);
|
Backbone.View.prototype.remove.call(this);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user