0.0.4 • Published 6 years ago

sound-alert.js v0.0.4

Weekly downloads
6
License
BSD-2-Clause
Repository
github
Last release
6 years ago

sound-alert.js

npm Package Version

JavaScript library to play sound alerts

alert = require('sound-alert.js')

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

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2-docv2

6 years ago

0.0.2-doc

6 years ago

0.0.2

6 years ago