Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 1000496 - [B2G][Clock]Deleting an alarm then killing the clock app a... #18613

Merged
merged 1 commit into from Apr 25, 2014

Conversation

mcav
Copy link
Contributor

@mcav mcav commented Apr 23, 2014

...nd relaunching it causes the deleted alarm to reappear.

…p and relaunching it causes the deleted alarm to reappear.
@@ -293,7 +293,7 @@ define(function(require, exports, module) {
window.dispatchEvent(new CustomEvent('alarm-removed', {
detail: { alarm: this }
}));
callback(err, this);
callback && callback(err, this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it cleaner like:

if (callback) {
  callback(err, this);
}

but since this pattern is also used on save I'm OK with it. - it's following the current code convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually a huge fan of the cb && cb() style, for callbacks at least. Callbacks have a unique set of constraints that, in my opinion, make the shorthand worthwhile: They are everywhere, they are almost always optional, and you aren't really conditionally doing something so you don't have to think too hard about what happens with the &&. So you're saving at least two lines in exchange for an idiom that, when applied mainly to callbacks, is simple to read and rationalize about.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

mcav added a commit that referenced this pull request Apr 25, 2014
Bug 1000496 - [B2G][Clock]Deleting an alarm then killing the clock app a... r=millermedeiros
@mcav mcav merged commit acde8c6 into mozilla-b2g:master Apr 25, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants