Skip to content

Commit

Permalink
chore(onChange): fixed shared value issue
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin committed Dec 16, 2016
1 parent 8bb548e commit 860be75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
export function OnChange(defaultValue?:any):any {
const sufix = 'Change';
return function OnChangeHandler(target:any, propertyKey:string):void {
let _value = defaultValue;
let _key = ` __${propertyKey}Value`;
Object.defineProperty(target, propertyKey, {
get():any { return _value; },
get():any { return this[_key]; },
set(value:any):void {
_value = value;
this[_key] = value;
this[propertyKey + sufix].emit(value);
}
});
Expand Down

0 comments on commit 860be75

Please sign in to comment.