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

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -