samedi 19 mars 2016

Get the type of ember object property by reflection

There is an ember object with a property as following

Instance: "foo" with a property

LoginID: Ember.computed.alias('LoginID'),

How do I properly get 'AliasedProperty' class name by reflection?

  1. Ember.typeOf(foo.LoginID) returns "object"
  2. foo.LoginID.toString() returns "[object Object]"
  3. typeof(foo.LoginID) returns "object"

However, js debugger could properly show

AliasedProperty {isDescriptor: true, altKey: "LoginID", _dependentKeys: Array[1]}

foo.LoginID.get.toString()

AliasedProperty_get(obj, keyName) { return _emberMetalProperty_get.get(obj, this.altKey); }

This is pretty close, but I'm expecting a return of "[object AliasedProperty]"

Thanks





Aucun commentaire:

Enregistrer un commentaire