Example 1

Call alert

ba("This is a message!")

Example 2

Call alert with title and message

ba("Hello!","This is a message!")

Example 3

Callbacks functions

ba({
  title: "You are sure?",
  message: "You want delete this post?",
  onConfirm: function(){
    ba("Your post has been deleted.")
  },
  onClose: function(){
    ba("Your post is safe :)")
  }
})

Example 4

Add class to butons

.btn_blue{
  background-color: blue;
}
.btn_red{
  background-color: red;
}

Example 5

Change text from buttons

ba({
  message: "Custom text",
  confirmText: "don't confirm that!",
  closeText: "close is safe"
})

Example 6

Click on shadow to close alert

ba({
  message: "Click on shadow to close",
  closeOnClickShadow: true
})

Example 7

Auto close

ba({
  message: "This messsage close in 1.5 seconds",
  autoClose: 1.5
})

Example 8

Auto close and on close

ba({
  message: "This messsage close in 1.5 seconds",
  autoClose: 1.5,
  onClose: function(){
    ba("Your post is safe :)")
  }
})

Install

npm i sajs

Usage

import sa from 'sajs'

🗓 2016-04-08
1604 👀