Uncaught (in promise) TypeError: Illegal invocation
See original GitHub issueHi, We updated from 10.16.7 to 11.0.5 and now we get an error with the current stack:
/node_modules/sweetalert2/dist/sweetalert2.all.js:284 Uncaught (in promise) TypeError: Illegal invocation
at runIfFunction (/node_modules/sweetalert2/dist/sweetalert2.all.js:284)
at blurActiveElement (/node_modules/sweetalert2/dist/sweetalert2.all.js:3253)
at initFocus (/node_modules/sweetalert2/dist/sweetalert2.all.js:3224)
at eval (/node_modules/sweetalert2/dist/sweetalert2.all.js:3171)
at new Promise (<anonymous>)
at swalPromise (/node_modules/sweetalert2/dist/sweetalert2.all.js:3139)
at SweetAlert._main (/node_modules/sweetalert2/dist/sweetalert2.all.js:3124)
at new SweetAlert (/node_modules/sweetalert2/dist/sweetalert2.all.js:3382)
at _construct (/node_modules/sweetalert2/dist/sweetalert2.all.js:133)
at Function.fire (/node_modules/sweetalert2/dist/sweetalert2.all.js:1428)
The error is caused in the line 284:
var runIfFunction = function runIfFunction(fn, arg) {
if (typeof fn === 'function') fn(arg); <-- error is marked here
};
We use Sweetalert inside a function:
const modalRemove = (options, clbk) => {
Swal.fire({
title: options.title || i18n.__('common.remove'),
text: options.text || i18n.__('text.remove'),
icon: options.icon || 'warning',
timer: 70000,
showClass: {
popup: '', // disable popup animation
},
allowEnterKey: false,
showCancelButton: true,
reverseButtons: true,
customClass: {
confirmButton: 'waves-effect waves-light btn error',
cancelButton: 'waves-effect waves-dark btn-flat white font-text',
},
confirmButtonText: options.confirm || i18n.__('common.remove'),
cancelButtonText: i18n.__('common.dismiss'),
}).then((result) => {
console.log(result); <-- The process doesn't arrives here
if (result.isConfirmed) {
clbk();
}
});
};
Any idea? Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
"Uncaught TypeError: Illegal invocation" in Chrome
In your code you are assigning a native method to a property of custom object. When you call support.animationFrame(function () {}) , it...
Read more >"Illegal invocation" errors in JavaScript - Matias Kinnunen
An "illegal invocation" error is thrown when calling a function whose this keyword doesn't refer to the object where it originally did. In...
Read more >Uncaught TypeError: Illegal invocation - jQuery Forum
Hi, I am getting the above error and can't figure our why? kindly help.. This is my code: var formData = new FormData(); ......
Read more >Uncaught TypeError: Illegal invocation in Ajax function
I'm trying to send a form to my handler, but I get an error "Uncaught TypeError: Illegal invocation". When I try to send...
Read more >Uncaught (in promise) TypeError: Illegal invocation
Uncaught (in promise) TypeError: Illegal invocation error using jQuery ajax code. To fix the error, try adding `processData: false` and ...
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
Thanks! The issue is related to
allowEnterKey: false
. I’ll fix it soon.Perfect, thank you for the quick response!