โคNovember Papa Mike

    bgio-effects
    TypeScript icon, indicating that this package has built-in type declarations

    0.7.1ย โ€ขย Publicย โ€ขย Published

    bgio-effects

    NPM Version Build Status Coverage Status

    ๐Ÿ“ค Helpers for managing state effects in boardgame.io.

    This package provides a structured approach to triggering ephemeral โ€œeffectsโ€ in game code that can be consumed from state on the client. It provides a game plugin and a client-side extension that emits events for your effects.

    ๐Ÿ’พ Installation

    npm i bgio-effects

    ๐Ÿ‘€ At a glance

    Call effects from your moves or other game code:

    function move(G, ctx) {
      ctx.effects.explode();
    }

    Listen for effects on the client:

    const onExplode = () => {
      // render explosion/play sound/etc.
    };
    
    // With the plain JS emitter
    emitter.on('explode', onExplode);
    
    // With the React hook
    useEffectListener('explode', onExplode, []);

    ๐Ÿ“š Documentation

    See the full documentation website โ†’

    ๐Ÿ™Œ Contributing

    This is an experimental project and feedback is welcome. Please open an issue if you run into any problems, have a question, or want to suggest features/improvements. PRs are welcome too ๐Ÿ˜Š.

    Please also note the code of conduct and be kind to each other.

    ๐Ÿ“„ License

    The code in this repository is provided under the terms of an Anti-Fascist MIT License.

    Install

    npm i bgio-effects

    DownloadsWeekly Downloads

    30

    Version

    0.7.1

    License

    SEE LICENSE IN LICENSE

    Unpacked Size

    64.2 kB

    Total Files

    48

    Last publish

    Collaborators

    • delucis