Calls fn with or without scope.$apply(), depending on if current thread is already inside $apply(). For AngularJS.