0.1.2 • Published 8 months ago

alert-for-web v0.1.2

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

Alert for Web - Show alert message on web page

npm version License: MIT

This is a simple script that shows an alert message on a web page. It can be used to show a message on a web page when a certain event occurs. For example, when a backup is completed, or when a long running process is finished.

installation

npm install alert-for-web

Usage

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Alert for Web</title>
    <!-- package css -->
    <link rel="stylesheet" href="https://www.unpkg.com/alert-for-web@0.1.2/dist/style.css">
    <script src="app.js" type="module">
  </head>
  <body>
    <button class="btn">Show Alert</button>
  </body>

app.js

//import package
import showAlert from "https://www.unpkg.com/alert-for-web@0.1.2/dist/main.js";

    //use any element to trigger the alert
    const btn = document.querySelector('.btn');

    btn.addEventListener("click", () => {
    //call the showAlert function
      showAlert({
        title: "Success",
        message: "This is a success alert",
        level: "success",
        button: "Close"
      })
    })

Options

OptionTypeDefaultOptionalDescription
titlestringnullnoThe title of the alert
messagestringnullnoThe message of the alert
levelstringsuccessyesThe level of the alert. Possible values are: success, warning, error.
buttonstringCloseyesThe text of the button

License

MIT

Authors

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago