Angular:

http://angularjs.org/

by mrajcok

HTML

<div ng-controller="MyCtrl">
  isAuthenticated={{isAuthenticated}}
    isAuthenticatedFn={{isAuthenticatedFn()}}
</div>

JavaScript

var myApp = angular.module('myApp',[]);

function MyCtrl($scope, $timeout) {
    $scope.isAuthenticated = false;
    $scope.isAuthenticatedFn = function() {
        return $scope.isAuthenticated
    };
    $timeout(function() {
        $scope.isAuthenticated = true
    }, 3000);
    $scope.$watch($scope.isAuthenticatedFn, function() {
        alert('watch1');
    });
    $scope.$watch($scope.isAuthenticatedFn(), function() {
        alert('watch2');
    }, true);
    $scope.$watch(function() { return $scope.isAuthenticatedFn()}, function() {
        alert('watch3');
    });
}