diff --git a/README.md b/README.md index c6aefc4..b67e8f3 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,14 @@ class TestElement extends Polymer.Element { @property() bar: string = 'yes'; + // @observe does not support simple observers, + // you can already do that via a normal property + @property({ observer: TestElement.prototype.onBazChanged }) + baz: string = 'test'; + + private onBazChanged(newValue: string, oldValue: string) { + } + // @query replaces the property with a getter that querySelectors() in // the shadow root. Use this for type-safe access to internal nodes. @query('h1') diff --git a/src/decorators.ts b/src/decorators.ts index 1bab1cc..1423522 100644 --- a/src/decorators.ts +++ b/src/decorators.ts @@ -43,7 +43,7 @@ export interface PropertyOptions { reflectToAttribute?: boolean; readOnly?: boolean; computed?: string; - observer?: string; + observer?: string|((val: any, old: any) => void); } /**