Ember.js: Brace expansion in `addObserver` doesn't work

Created on 17 May 2016  路  5Comments  路  Source: emberjs/ember.js

This is a tortured example, but I believe it illustrates the problem:

https://ember-twiddle.com/fad06431ff6f578dd6b6762b6ef1282c?fileTreeShown=false&openFiles=controllers.application.js%2C

If given a property key with the brace expansion syntax, it won't update. Without it, it works fine.

All 5 comments

This isn't a bug, but rather not something low level API such as addObserver support. I can appreciate why this seems strange, but the brace expansion only exists for the high level API's used at class design time. This is partly due to performance reasons, and partly to the idea of brace expansion is currently just sugar on top.

It would be great if this was documented in that case

It would be great if this was documented in that case

It is, by virtue of only being documented for the high level apis. The addObserver documentation clearly states it takes a path, and does not imply it takes a path w brace expansions.

Polluting every low-level API with the docs corresponding to the high level usage seems like a bad idea. Also in reality these are 2 very dfifferent API, it just happens to be that currently the high level one delegates to this low level one in some what.

Technically in the API, it's not documented for either method: http://emberjs.com/api/classes/Ember.computed.html

Though I suppose it only references brace expansion in reference to CP's here: https://guides.emberjs.com/v2.3.0/object-model/computed-properties/

Technically in the API, it's not documented for either method: http://emberjs.com/api/classes/Ember.computed.html

might be good to document it at that level

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rlivsey picture rlivsey  路  34Comments

GendelfLugansk picture GendelfLugansk  路  43Comments

matheusdavidson picture matheusdavidson  路  37Comments

skoryky picture skoryky  路  50Comments

workmanw picture workmanw  路  79Comments