Mandatory reject param?
See original GitHub issueHi there!
I’m upgrading my code to v4, and I saw that the new reject(dismiss)
Promise is mandatory to avoid browser errors. If I do not set a dismiss function, I get the following error in Chrome:
Uncaught (in promise) cancel
Would be possible to make this reject optional? Sometimes we just want to close the popup if the user hits cancel, and not show a new swal to confirm that the user clicked cancel successfully.
If I code an empty dismiss function just to avoid this error, ES6 linters will fire up to not create empty functions, and the code would not be accepted for deployment.
Best regards, Rafael.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Promise.reject() - JavaScript - MDN Web Docs
The Promise.reject() method returns a Promise object that is rejected with a given reason.
Read more >Reject parameters not in Param() statement - Stack Overflow
How do I tell the powershell parameter handling machinery that the only valid parameters are the ones I explicitly state in the Param...
Read more >Optional parameters should reject `undefined` parameter values
node built/local/tsc.js --strictNullChecks index.ts index.ts(5,3): error TS2345: Argument of type 'undefined' is not assignable to parameter ...
Read more >ActionController::Parameters - Rails API
Action Controller Parameters Allows you to choose which attributes should be ... The former is used to mark parameters as required. ... Alias...
Read more >7.12 Reject Statements | Stan Reference Manual
The Stan reject statement provides a mechanism to report errors or problematic values encountered during program execution and either halt processing or reject...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@samturrell I implemented your suggestion in v4.0.6 https://jsfiddle.net/limon/2ya7akjq/
Thank you Sam, with your help we finally found the solution for this issue.
The only way i can really see this being resolved is with an opt-in solution such as
And then
swal().done()
to suppress the error.There is no way to fix this without using a non-native promise implementation where we can suppress the error internally.