this is a simple wrap to sweetalert2 .
the window.modSweetAlert2Mod.fire()
=== Swal.fire()
, the window.modSweetAlert2Mod.Swal
=== Swal
{
"dependenceInfo": [
{
"modName": "SweetAlert2Mod",
"version": "^1.0.0"
}
]
}
example :
window.modSweetAlert2Mod.fire(
// do anything the ``Swal.fire()`` can do
{
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}
);
example : (same as the official example "input-types password" )
(async () => {
const {value: password} = await window.modSweetAlert2Mod.fire({
title: 'Enter your password',
input: 'password',
inputLabel: 'Password',
inputPlaceholder: 'Enter your password',
inputAttributes: {
maxlength: 1000,
autocapitalize: 'off',
autocorrect: 'off'
}
})
if (password) {
await window.modSweetAlert2Mod.fire(`Entered password: ${password}`)
}
})().catch(E => {
console.error(E);
});