Skip to content

Commit 90c85a5

Browse files
author
Steven Orvell
committed
Address review feedback.
1 parent 8f5815f commit 90c85a5

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1919
## Unreleased
2020

2121
### Changed
22-
* Added a static `createPropertyDescriptor` method to allow easier customization of property accessors. This method should return a a `PropertyDescriptor` to install on the property. If no descriptor is returned, a property accessor is not be created. ([#911](https://github.com/Polymer/lit-element/issues/911))
22+
* Added a static `getPropertyDescriptor` method to allow easier customization of property accessors. This method should return a a `PropertyDescriptor` to install on the property. If no descriptor is returned, a property accessor is not be created. ([#911](https://github.com/Polymer/lit-element/issues/911))
2323
* The value returned by `render` is always rendered, even if it isn't a `TemplateResult`. ([#712](https://github.com/Polymer/lit-element/issues/712))
2424

2525
### Added

src/lib/updating-element.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ export abstract class UpdatingElement extends HTMLElement {
294294
* This method may be overridden to customize properties; however,
295295
* when doing so, it's important to call `super.createProperty` to ensure
296296
* the property is setup correctly. This method calls
297-
* `createPropertyDescriptor` internally to get a descriptor to install.
297+
* `getPropertyDescriptor` internally to get a descriptor to install.
298298
* To customize what properties do when they are get or set, override
299-
* `createPropertyDescriptor`. To customize the options for a property,
299+
* `getPropertyDescriptor`. To customize the options for a property,
300300
* implement `createProperty` like this:
301301
*
302302
* static createProperty(name, options) {
@@ -323,20 +323,20 @@ export abstract class UpdatingElement extends HTMLElement {
323323
return;
324324
}
325325
const key = typeof name === 'symbol' ? Symbol() : `__${name}`;
326-
const descriptor = this.createPropertyDescriptor(name, key, options);
326+
const descriptor = this.getPropertyDescriptor(name, key, options);
327327
if (descriptor !== undefined) {
328328
Object.defineProperty(this.prototype, name, descriptor);
329329
}
330330
}
331331

332332
/**
333-
* Creates a property descriptor to be defined on the given named property.
333+
* Returns a property descriptor to be defined on the given named property.
334334
* If no descriptor is returned, the property will not become an accessor.
335335
* For example,
336336
*
337337
* class MyElement extends LitElement {
338-
* static createPropertyDescriptor(name, key, options) {
339-
* const defaultDescriptor = super.createPropertyDescriptor(name, key, options);
338+
* static getPropertyDescriptor(name, key, options) {
339+
* const defaultDescriptor = super.getPropertyDescriptor(name, key, options);
340340
* const setter = defaultDescriptor.set;
341341
* return {
342342
* get: defaultDescriptor.get,
@@ -352,7 +352,7 @@ export abstract class UpdatingElement extends HTMLElement {
352352
*
353353
* @nocollapse
354354
*/
355-
protected static createPropertyDescriptor(name: PropertyKey,
355+
protected static getPropertyDescriptor(name: PropertyKey,
356356
key: string|symbol, _options: PropertyDeclaration) {
357357
return {
358358
// tslint:disable-next-line:no-any no symbol in index
@@ -379,6 +379,7 @@ export abstract class UpdatingElement extends HTMLElement {
379379
* Note, this method should be considered "final" and not overridden. To
380380
* customize the options for a given property, override `createProperty`.
381381
*
382+
* @final
382383
*/
383384
protected static getPropertyOptions(name: PropertyKey) {
384385
return this._classProperties && this._classProperties.get(name) ||

src/test/lib/updating-element_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,8 +1871,8 @@ suite('UpdatingElement', () => {
18711871
@customElement(generateElementName())
18721872
class E extends UpdatingElement {
18731873

1874-
static createPropertyDescriptor(name: PropertyKey, key: string|symbol, options: MyPropertyDeclaration) {
1875-
const defaultDescriptor = super.createPropertyDescriptor(name, key, options);
1874+
static getPropertyDescriptor(name: PropertyKey, key: string|symbol, options: MyPropertyDeclaration) {
1875+
const defaultDescriptor = super.getPropertyDescriptor(name, key, options);
18761876
return {
18771877
get: defaultDescriptor.get,
18781878
set(this: E, value: unknown) {

0 commit comments

Comments
 (0)