ForgeComponents
en

Components

j-Sounds

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

This component contains some predefined sounds like beep, fail, success, etc... Path contains a volume control in percentage, 0 disables playing.


Configuration:

  • url {String} URL address to sound library (default: https://cdn.componentator.com/sounds/)
  • volume {Number} (default: 50)

Good to know:

path can contain {Number}, which will control volume or {Boolean} which will enable or disable sounds.

Methods:

  • component.play(sound) supported sounds:
    • alert
    • message
    • badges
    • notifications
    • beep
    • confirm
    • done
    • drum
    • fail
    • success
  • component.success()
  • component.fail()
  • component.alert(), component.error()
  • component.warning()
  • component.notify()
  • component.badge()
  • component.confirm()
  • component.beep()
  • component.drum()

Use it with <ui-component name="sounds">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<ui-component name="sounds" path="volume"></ui-component>

<script>
	var volume = 80;

	setTimeout(function() {
		SETTER('sounds/play', 'beep');
	}, 1000);

	setTimeout(function() {
		SETTER('sounds/play', 'drum');
	}, 3000);

	setTimeout(function() {
		SETTER('sounds/play', 'fail');
	}, 7000);

</script>