How does the Ember meta object system work?

I am exploring some of Ember’s internals especially ember-runtime. More specifically the Meta object that is present on nearly every object in Ember.

I see an old-skool Meta class in utils.js. The __meta property appears to be an instance of this class.

It see it has the following properties. What information do these properties store?

  • descs
  • watching
  • cache
  • source (this looks like a circular reference to the containing object itself)

The meta with these base properties appears to be augmented by additional properties like mixins and others by other parts higher up in the runtime.

A little above this sits the Ember.meta, Ember.get/setMeta helpers which set or pulls out the meta of an object.

It appears to me that a great deal of thought went into this layer that lies underneath ember, and every layer builds upon it until the final Ember.Object tier is reached.

Can someone share some insights into how these layers work and how these things tie together.

Thanks.

4 Likes