Git Product home page Git Product logo

bgio-effects's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.