-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds minor new API for enabling updating and querying assigned nodes. #860
Conversation
By default this is called in `connectedCallback`. Subclasses can customize when updating is initialized by overriding `connectedCallback` and calling `initializeUpdating`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Will this return the same nodes/be updated in the same way regardless of whether using the polyfill or not? |
src/lib/decorators.ts
Outdated
* A property decorator that converts a class property into a getter that | ||
* returns the `assignedNodes` of the given named `slot`. | ||
* | ||
* @ExportDecoratedItems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be @ExportDecoratedItems
any more, as of angular/tsickle#1125
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
CHANGELOG.md
Outdated
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
<!-- ### Added --> | |||
<!-- ### Removed --> | |||
|
|||
### Added | |||
* Added `enableUpdating()` to `UpdatingElement` to enable customizing when updating is enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SInce it doesn't look like we have issues for these, can you link to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/lib/decorators.ts
Outdated
|
||
/** | ||
* A property decorator that converts a class property into a getter that | ||
* returns the `assignedNodes` of the given named `slot`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should document the type that the property should be annotated with, ie NodeListOf<HTMLElement>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Adds a protected method called
enableUpdating
toUpdatingElement
. Before this, updating is enabled when the element is connected in a way that is not easily customizable. Adding this API enables subclasses to control when updates are allowed to begin.Adds a
queryAssignedNodes(slotName: string, flatten: boolean)
decorator. This provides a convenient way to retrieve the nodes distributed to a given slot via a property and is a shorthand forthis.shadowRoot.querySelectorAll(
slot[name=${slotName}]).assignedNodes(flatten)
.