ember.js - How to know whether a method is a call made by me thgh code or its from observer -
i have method in view following.
testmethod : function() { //run code }.observes('property1')
this method can either trigerred directly calling or triggered property1 observer. possible know inside method, way call getting triggered. thanks
when observer called, receives 2 arguments: controller object, , observed property has changed , triggered observer.
so can check this:
testmethod : function() { if(arguments.length === 2 && arguments[1] === 'property1'){ // you're triggered property observer } else { // triggered directly } }.observes('property1')
this, of course, can spoofed caller..
Comments
Post a Comment