Skip to content

azer/alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alert

JavaScript library to play sound alerts

alert = require('alert')

alert() // Plays default alert "bottle"
alert('purr')
alert.volume(0.5)

See content.js for all available sounds.

Try it at

Install

$ npm install alert

Manual

Available Sounds

  • bottle (default)
  • glass
  • funk
  • morse
  • purr
  • tink
  • submarine

Adding Custom Sounds

alert.content['foo'] = ['http://bar.com/foo.mp3', 'http://bar.com/foo.ogg']
alert('foo')

How to use without NPM?

If your application isn't structured as a CommonJS package, you can download the distribution file;

$ wget https://raw.github.com/azer/alert/master/dist/alert.js

And include it on your page:

<script src="alert.js"></script>
<script>
  playAlert('purr')
</script>

Accessing Audio API

alert.player.src()
// => foobar.mp3

alert.player.on('ended', function(){})

More info is at azer/play-audio

About

JavaScript library to play sound alerts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published