question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cancel button calls resolve

See original GitHub issue

In the ‘Are you sure?’ examples, the cancel button should call reject, not resolve (Proper promise syntax, I think)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
limontecommented, Jun 12, 2016

Thank you @AmitMY for standing for you point, I probably have to agree with you and make this breaking change 😃

Please give your opinion about this structure:


swal({
  ...
}).then(function(result) {
  // handle confirm, result is needed for modals with input
}, function(dismiss) {
  // dismiss can be "cancel" | "close" | "outside"
});

cc @samturrell @Tonkpils @jdcrensh

3reactions
AmitMYcommented, Jun 11, 2016

In my opinion, because all do the same action, they should do reject() That way, if there is a promise in the SWAL, and it rejects, it will normally reject(error), such that you can handle by checking if(error) And if not, and the promise sends reject() it means just ‘close’ - no nead for error handling.

This removes the check if(isConfirm), and uses the build in promise rejection

What do you think? Where am I logically failing?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Call cancel button - Power Platform Community - Microsoft
Solved: Hi guys! I have an app where users make requests for data changes to the system. This app feeds a list to...
Read more >
How to create a HTML Cancel button that redirects to a URL
Run code snippet ... Assign type="button" to the cancel button within a form, then; set a href="/wherever_page_needs_to_go" attribute (alt tags, titles, ...
Read more >
Enable Resolve and Cancel Button in Portal : r/servicenow
Enable Resolve and Cancel Button in Portal. Hi guys, is there and OOB option that i can enable so user can cancel or...
Read more >
Promise.all() - JavaScript - MDN Web Docs
The Promise.all() method takes an iterable of promises as input and returns a single Promise. This returned promise fulfills when all of the ......
Read more >
Power button ends call - Android Accessibility Help
Open your device's Settings app . Tap Accessibility. Turn on Power button ends call.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found