Skip to content

Commit

Permalink
simple observer readme (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j authored and aomarks committed Dec 27, 2017
1 parent d6b3fa3 commit 40edb35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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
2 changes: 1 addition & 1 deletion src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface PropertyOptions {
reflectToAttribute?: boolean;
readOnly?: boolean;
computed?: string;
observer?: string;
observer?: string|((val: any, old: any) => void);
}

/**
Expand Down

0 comments on commit 40edb35

Please sign in to comment.