0.1.6 • Published 2 months ago

@subrotosaha/notification v0.1.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

Notification

0.1.6

Added

  • Added notification class
  • Added notify function
    • Added success method
    • Added error method
    • Added warning method
    • Added info method
  • Added confirm function
    • Added success method
    • Added warning method
  • Added Definition for typescript on v0.1.6

installation

npm i @subrotosaha/notification

usage

import notification from "@subrotosaha/notification";
import "@subrotosaha/notification/style.css";

example

notification

Created a button or any element with ids `success,warning,error,info` and add the following code to your js file
document.querySelector('#success').addEventListener('click', () => {
  notification.notify.success('notification ok');
})
document.querySelector('#warning').addEventListener('click', () => {
  notification.notify.warning('notification warning');
})
document.querySelector('#error').addEventListener('click', () => {
  notification.notify.error('notification error');
})
document.querySelector('#info').addEventListener('click', () => {
  notification.notify.info('notification information');
})

confirm

Created a button or any element with ids `confirmsuccess,confirmwarning` and add the following code to your js file

document.querySelector("#confirmsuccess").addEventListener("click", () => {
  notification.confirm
    .success("Are you sure?", "Please confirm your action", {
      ok: { text: "Confirm" },
      cancel: { text: "Cancel" },
    })
    .then((result) => {
      console.log(result); // true if confirmed, false if cancelled
    });
});
document.querySelector("#confirmwarning").addEventListener("click", () => {
  notification.confirm
    .warning("Are you sure?", "Please confirm your action", {
      ok: { text: "Confirm" },
      cancel: { text: "Cancel" },
    })
    .then((result) => {
      console.log(result); // true if confirmed, false if cancelled
    });
});
```
0.1.6

2 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago