Lightweight audio library to play sound effects.
npm install simple-sfx
import simpleSFX from 'simple-sfx';
const sfx = new simpleSFX([
'static/start.ogg',
'static/click.mp3'
]);
Quick
sfx.play('start');
With parameters
sfx.play({
name: 'start',
volume: 0.8,
loop: false
})
Single
sfx.stop('start');
Multiple
sfx.stop([
'start',
'click'
]);
All
sfx.stop();
sfx.off();
sfx.on();
Included working examples for React and Vue.
Start with running these in the root folder ./
npm install
npm run build
Navigate to the ./examples/react
folder
npm install
npm start
Module imported in: ./examples/react/src/App.js
Navigate to the ./examples/vue
folder
npm install
npm run dev
Module imported in ./examples/vue/src/App.vue
npm run test
The MIT License (MIT)
Copyright © 2019 Tamas Szoke