Commit e0704171 authored by Robert Knight's avatar Robert Knight

Rename a few identifiers and update comments for clarity

Respond to CR feedback.
parent 5725b25d
......@@ -7,15 +7,16 @@ function useExpressionBinding(propName) {
}
/**
* Base controller class for React component wrappers.
* Controller for an Angular component that wraps a React component.
*
* This is responsible for rendering the React component into the DOM element
* created by the Angular wrapper component.
* This is responsible for taking the inputs to the Angular component and
* rendering the React component in the DOM node where the Angular component
* has been created.
*/
class ReactController {
constructor($element, $scope, injectedProps, type) {
/** The DOM element where the React component should be rendered. */
this.element = $element[0];
this.domElement = $element[0];
/** The React component function or class. */
this.type = type;
......@@ -54,7 +55,7 @@ class ReactController {
}
this.props[propName] = this[propName];
});
this.render();
this.updateReactComponent();
}
$onChanges(changes) {
......@@ -65,19 +66,18 @@ class ReactController {
this.props[propName] = changes[propName].currentValue;
}
});
this.render();
this.updateReactComponent();
}
$onDestroy() {
// Unmount the rendered React component. Although Angular will remove the
// element itself, this is necessary to run any cleanup/unmount lifecycle
// hooks in the React component tree.
render(createElement(null), this.element);
render(createElement(null), this.domElement);
}
render() {
// Create or update the React component.
render(createElement(this.type, this.props), this.element);
updateReactComponent() {
render(createElement(this.type, this.props), this.domElement);
}
}
......
......@@ -238,7 +238,7 @@
esutils "^2.0.2"
js-tokens "^4.0.0"
"@babel/parser@^7.0.0", "@babel/parser@^7.4.0":
"@babel/parser@^7.0.0", "@babel/parser@^7.2.2", "@babel/parser@^7.4.0":
version "7.4.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.2.tgz#b4521a400cb5a871eab3890787b4bc1326d38d91"
integrity sha512-9fJTDipQFvlfSVdD/JBtkiY0br9BtfvW2R8wo6CX/Ej2eMuV0gWPk1M67Mt3eggQvBqYW1FCEk8BN7WvGm/g5g==
......@@ -669,7 +669,7 @@
globals "^11.1.0"
lodash "^4.17.11"
"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0":
"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0", "@babel/types@^7.4.0":
version "7.4.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.0.tgz#670724f77d24cce6cc7d8cf64599d511d164894c"
integrity sha512-aPvkXyU2SPOnztlgo8n9cEiXW755mgyvueUPcpStqdzoSPm0fjO0vQBjLkt3JKJW7ufikfcnMTTPsN1xaTsBPA==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment