Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refactor($rootScope): consistently use noop as the default $watch listener #16343

Merged
merged 1 commit into from
Dec 5, 2017

Conversation

jbedard
Copy link
Collaborator

@jbedard jbedard commented Nov 24, 2017

By doing the isFunction(listener) check before delegating to $$watchDelegate it removes that check from some $$watchDelegate methods.

@petebacondarwin
Copy link
Contributor

petebacondarwin commented Nov 24, 2017

I think there are other opportunities here:

if (isFunction(this.listener)) {
this.listener.call(null, result, newExpressionValues === oldExpressionValues ? result : this.previousResult, this.scope);
}

and here:
if (isFunction(this.listener)) {
this.listener.call(null, newMessage, newMessage === oldMessage ? newMessage : this.lastMessage, this.scope);
}

@Narretz Narretz added this to the 1.6.8 milestone Dec 4, 2017
@Narretz
Copy link
Contributor

Narretz commented Dec 5, 2017

@jbedard do you want to incorporate @petebacondarwin suggestions? If not, I will merge

@jbedard
Copy link
Collaborator Author

jbedard commented Dec 5, 2017

I did those suggestions (but please double check!). I think it's ready to merge.

@Narretz Narretz merged commit 394b185 into angular:master Dec 5, 2017
Narretz pushed a commit to Narretz/angular.js that referenced this pull request Dec 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants