Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
e0704171
Commit
e0704171
authored
Mar 28, 2019
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename a few identifiers and update comments for clarity
Respond to CR feedback.
parent
5725b25d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
wrap-react-component.js
src/sidebar/util/wrap-react-component.js
+10
-10
yarn.lock
yarn.lock
+2
-2
No files found.
src/sidebar/util/wrap-react-component.js
View file @
e0704171
...
...
@@ -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
.
e
lement
=
$element
[
0
];
this
.
domE
lement
=
$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
.
e
lement
);
render
(
createElement
(
null
),
this
.
domE
lement
);
}
render
()
{
// Create or update the React component.
render
(
createElement
(
this
.
type
,
this
.
props
),
this
.
element
);
updateReactComponent
()
{
render
(
createElement
(
this
.
type
,
this
.
props
),
this
.
domElement
);
}
}
...
...
yarn.lock
View file @
e0704171
...
...
@@ -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==
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment