大佬教程收集整理的这篇文章主要介绍了javascript – Ember.Instrumentation API示例,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
一般而言,Instrumentation是一种通过订阅命名空间侦听器来衡量应用程序中的性能和其他指标的方法.它也可用于调试.
例
我不能因为制作这个小提琴而受到赞扬,我昨晚只在NYC ember.js聚会上看到它,但这应该提供一些背景信息:
在我想弄清楚是谁的时候,我只能找到他的聚会资料:http://www.meetup.com/EmberJS-NYC/members/6706336/
要看到魔力发生,打开你的控制台,开始将学生标记为“在这里”.
查看顶部附近的StudentView和底部的Em.Subscribe.
// In a view Em.instrument("student.here",this.get('content'),function() { //mark student as in attendance this.set('inAttendance',!this.get('inAttendance')); },this); },
…
Em.subscribe('*',{ ts: null,before: function(name,timestamp,payload) { ts = timestamp; //console.log(' before: ',name,JSON.stringify(payload)); //return 'HelloFromThePast'; },after: function(name,payload,beforeRet) { //log metrics //record analytics //profile app console.log('instrument: ',JSON.stringify(payload),beforeRet,timestamp - ts); } });
边注
甚至更酷的是你可以使用通配符订阅ember使用的仪器.
http://jsfiddle.net/dmazza/sUvdg/
文档
有关详细信息,请参阅文档:http://emberjs.com/api/classes/Ember.Instrumentation.html
以上是大佬教程为你收集整理的javascript – Ember.Instrumentation API示例全部内容,希望文章能够帮你解决javascript – Ember.Instrumentation API示例所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。