简体   繁体   English

有没有办法将所有绑定列表到Ember.Object?

[英]Is there a way to list all the Bindings to an Ember.Object?

Example in coffeescript coffeescript中的示例

window.APP = Ember.Application.create()

APP.stuff = Ember.Object.create(
  name: "The Name"
)

APP.things = Ember.Object.create(
  nameBinding: "APP.stuff.name"
)

APP.gizmos = Ember.Object.create(
  nameBinding: "APP.stuff.name"
)

Is there anyway to detect that APP.stuff has 2 bindings to its name property? 反正有没有检测到APP.stuff有2个绑定到它的名称属性?

I finally found the answer after digging through lots of source code.... 我在挖掘了大量源代码后终于找到了答案....

I'm not sure the Devs recommend this approach....but it gives me what I want. 我不确定开发者推荐这种方法......但它给了我想要的东西。

Basically the answer is to call... 基本上答案是打电话给...

Ember.meta(APP.stuff)

This returns an object that contains a "watching" hash, which contains the properties being watched and the number of watchers. 这将返回一个包含“观察”哈希的对象,该哈希包含正在观看的属性和观察者数量。

Ember is cool. 恩伯很酷。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM