Nature's Powerful Meme

    simple-sfx

    1.0.1 • Public • Published

    simple-sfx

    Build Status

    Lightweight audio library to play sound effects.

    Installation

    npm install simple-sfx
    

    Usage

    import simpleSFX from 'simple-sfx';
    

    Load

    const sfx = new simpleSFX([
        'static/start.ogg',
        'static/click.mp3'
    ]);
    

    Play

    Quick

    sfx.play('start');
    

    With parameters

    sfx.play({
        name: 'start',
        volume: 0.8,
        loop: false
    })
    

    Stop

    Single

    sfx.stop('start');
    

    Multiple

    sfx.stop([
        'start',
        'click'
    ]);
    

    All

    sfx.stop();
    

    Disable

    sfx.off();
    

    Enable

    sfx.on();
    

    Examples

    Included working examples for React and Vue.

    Start with running these in the root folder ./

    npm install
    npm run build
    

    React

    Navigate to the ./examples/react folder

    npm install
    npm start
    

    Module imported in: ./examples/react/src/App.js

    Vue

    Navigate to the ./examples/vue folder

    npm install
    npm run dev
    

    Module imported in ./examples/vue/src/App.vue

    Tests

    npm run test
    

    License

    The MIT License (MIT)
    Copyright © 2019 Tamas Szoke

    https://opensource.org/licenses/MIT

    Install

    npm i simple-sfx

    DownloadsWeekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    13.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • tamasszoke