Skip to content

Commit

Permalink
simple observer readme
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j authored and 43081j committed Dec 26, 2017
1 parent 9bcac25 commit d48967d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface PropertyOptions {
notify?: boolean;
reflectToAttribute?: boolean;
readOnly?: boolean;
observer?: string|((val: any, old: any) => void);
}

/**
Expand Down

0 comments on commit d48967d

Please sign in to comment.