-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($timeout): overload service API. #9723
Conversation
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
I don't really see the benefit. Instead of writing |
CLA verified in person, cc @jeffbcross |
Provide an overload for $timeout that doesn't take a function. Closes angular#9176
} else { | ||
fn = noop, | ||
delay = arguments[0], | ||
invokeApply = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if invokeApply
is defined when calling $timeout
, then it should be respected. BTW, if the default changes when defining or not a function, then the documentation needs to be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the default changes, then we're not landing it --- jus saying, that is a really pointless breaking change. But it shouldn't change if your comment is addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, @vasileorza please don't do the arguments[0]
etc thing --- use named formal parameters instead, it is so much easier to read
@gkalpak - I guess the benefit is that you might just want to create a promise that is passed elsewhere; the creator of the timeout might not be attaching any callback at all. |
I think we can merge this - eventually. We need to check the CLA and ensure there are definitely no related regressions or breaking changes. |
I think regressions are unlikely in this case, and it's hard to see what the breaking change would be if comments are addressed. The It should be more like if (typeof fn === 'number') {
invokeApply = delay;
delay = fn;
fn = noop;
} And then only invoke |
CLA signature verified! Thank you! Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes). |
@petebacondarwin:
So, this deoesn't really add any new feature, it is just syntactic sugar. Not that it wasn't possible before, but this new syntax is like "asking for it". |
I fixed up the PR and landed - thanks @vasileorza for the work; and @caitp, @lgalfaso and @gkalpak for the reviewing. |
Provided an overload for $timeout that doesn't take a function.
Closes #9176