Skip to content

Latest commit

 

History

History
195 lines (119 loc) · 4.02 KB

README.md

File metadata and controls

195 lines (119 loc) · 4.02 KB

JSNotifications

JSNotifications

Html notifications pure javascript.

Add Html Code

<script src="assets/notifications.min.js" type="text/javascript"></script>

Find example in notifications.html

Init Notifications

Notification(Time shows message in seconds)

Example :

Notify = new Notification()

Use default time shows message (8 seconds)

Notify = new Notification(4)

Set default time shows message (4 seconds)

Notify = new Notification(0)

Disabble time (allways on screen)

Note: To close any notification, just click on the notification

Notification Types

  • Warning
  • Info
  • Alert
  • OK

All Notifications Methods

stateNotifications(true|false)

Show/Hide Notifications. Default is true

Example :

Notify.stateNotifications(true)

Show Notifications

Notify.stateNotifications(false)

Dont Show Notifications


getNotificationsState()

Get Notifications state, return true or false


setTemporaryOff()

Hide (Temporary) Notifications


getTemporaryState()

Get Temporary Notifications state, return true or false


cancelTemporaryOff()

Cancel setTemporaryOff


addNotification(Notification ID, Notification Type, Message, Time shows message)

Add/Show Notification (If the id already exists an update will be made)

Example :

Notify.addNotification("01", "Alert", "Notification 01");

Use default time shows message

Notify.addNotification("01", "Alert", "Notification 01", 10);

Sets 10 seconds for the time it shows message for this notification

Notify.addNotification("01", "Alert", "Notification 01", 0);

Shows the notification until the delNotification or delallNotifications method is called or the notification is clicked


updateNotification(Notification ID, Notification Type, Message, Time shows message)

Update/Change Notification


setNotificationTimeOut(Notification ID, time in seconds)

Set time shows notification message

Example :

Notify.setNotificationTimeOut("01", 4);

Set 4 seconds time shows message for notification with id "01"


delNotification(Notification ID)

Delete/Remove Notification from screen

Example :

Notify.delNotification("01")

delallNotifications()

Delete all notification

Notification history Window (last 25 notifications)

showLastNotifications()

Show notification history


closeLastNotifications()

Close notification history


delLastNotifications()

Delete all notification history