aurelia / aurelia/templating

Enhance the @bindable decorator with a <propertyName>Set handler

Open
#551 9 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
113
Forks
101
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a feature request**

* **Library Version:**
1.4.1 (aurelia-templating)

**Please tell us about your environment:**
* **Operating System:**
OSX 10.11.6

* **Node Version:**
6.10.0

* **NPM Version:**
4.3.0

* **JSPM OR Webpack AND Version**
JSPM 0.16.53

* **Browser:**
all

* **Language:**
ESNext

**Current behavior:**
`@bindable` supports `Changed` event handlers. So, if one has a bindable property in a custom element named `value`, and if a method on the custom element's class called `valueChanged` is present, it will fire. This is great!

**Expected/desired behavior:**

It would be nice if `@bindable` supported `Set` event handlers. So, if one has a bindable property named `value`, and if a method on the custom element's class called `valueSet` is present, it will fire, _anytime there's an attempt to set the value and regardless of whether the new value is the same as, or different from, the old value_.

* **What is the motivation / use case for changing the behavior?**
Sometimes the very act of setting a value on a bindable is meaningful in itself. Both _setting_ and _changing_ can have independent significance.

Contributor guide

Open the contributing guide

Research direction

Start by locating the @bindable decorator implementation in aurelia-templating and review how existing Changed handlers are detected and invoked. Add coverage for a valueSet handler that runs when the value is set to both the same and a different value, and confirm existing Changed behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.