Force observable to populate change event

Hello.

I am still new to Aurelia. Maybe its a bit stupid question, but googling it does not really helped.
So the question is sounds like this: Does aurelia binding engine have something similar to valueHasMutated method from knockout library?

For those who did not familiar with knockout: this method force observable and all its bindings and depencies to update while the observable`s value itself does not really changed.

In some cases (which are exceptional) such method becomes very handy.

Thanks for your answers.

Here is valueHasMutated method :slight_smile:

valueHasMutated() {
  const old = this.value;
  this.value = !old;
  this.value = old;
}

Yeah, but not quite :wink:

Acctulay such method will trigger update dependencies twice:

  1. first time when you type castthis.value to boolean
  2. second time when you writing back original value.

This cusses two issues:

  1. Unnecessary observable update
  2. While this.value can be basically anything - casting it to boolean may cause unexpected behavior in views, subscriptions and so on.

Actually only one update, aurelia-binding is smart enough to merge them.

Furthermore, because the intermediate change is thrown away by aurelia-binding, it will rarely have surprising side effects due to boolean type.

Just tested your solution - amazing, but it works :thinking: