A beautiful replacement for JavaScript's "alert"

$ npm install --save sweetalert
import swal from 'sweetalert'
swal("Hello world!")
Many improvements and breaking changes have been introduced in the 2.0 release. Make sure you read the upgrade guide to avoid nasty suprises!
swal("Oops!", "Something went wrong!", "error")
javascript
swal({
title: "Are you sure?",
text: "Are you sure that you want to leave this page?",
icon: "warning",
dangerMode: true,
})
.then(willDelete => {
if (willDelete) {
swal("Deleted!", "Your imaginary file has been deleted!", "success");
}
});if (willDelete) { swal("Deleted!", "Your imaginary file has been deleted!", "success"); } ```
javascript
swal("Type something:", {
content: "input",
})
.then((value) => {
swal(`You typed: ${value}`);
})swal(You typed: ${value});
```
javascript
swal({
text: 'Wanna log some information about Bulbasaur?',
button: {
text: "Search!",
closeModal: false,
},
})
.then(willSearch => {
if (willSearch) {
return fetch(`http://pokeapi.co/api/v2/pokemon/1`)
}
})
.then(result => result.json())
.then(json => console.log(json))
.catch(err => {
swal("Oops!", "Seems like we couldn't fetch the info", "error")
})if (willSearch) {
try {
const result = await fetch(http://pokeapi.co/api/v2/pokemon/1)
const json = await result.json()
console.log(json)
} catch (err) {
swal("Oops!", "Seems like we couldn't fetch the info", "error")
}
}
```
src folder.npm run docsdocs-src folder.npm run docsnpm run builddocs to compile the changes to the docs folder$ claude mcp add sweetalert \
-- python -m otcore.mcp_server <graph>