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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -