Make ReactWrapperView globals explicit

This commit is contained in:
Daniel Gasienica 2018-04-14 23:27:38 -04:00
parent 4a5a2cb5c1
commit 3acdeb90c3

View file

@ -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);
}, },
}); });