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.

Dependents (0)

Package Sidebar

Install

npm i bgio-effects

Weekly Downloads

6

Version

0.7.1

License

SEE LICENSE IN LICENSE

Unpacked Size

64.2 kB

Total Files

48

Last publish

Collaborators

  • delucis