Giter Club home page Giter Club logo

eventgoround's Introduction

Event Go Round

Event Go Around is a simple event system in golang planned for use to dispatch events for game backends. The usage of generics guarantees that events can be of any type. It was designed and written when i started working on a gaming backend as my first serious golang project. Initially this event system was written as a part of the backend, but then making it its own package seemed like a good idea since it can be used for all sorts of things requiring event based synchronization.

Features

I tried to keep this event system simple and useful for my use cases, the requirements of which were:

  • Thread safe - dispatching an event is thread safe and can run concurrently
  • Decoupled - How you design your events is completely up to you and is not enforced by Event Go Round. Only the event handlers need to implement the Listener interface.
  • Simplicity - in order to avoid code generators but still be able to group main aspects of an EventManager the GetEventData[T] generic function provides a simple way to retreive an event data into its correct type.

An important note to keep in mind is that stopping a manager will clear its current event queue but will not detach the listeners.

Todo

Things I would probably want to do are:

  • Enable running managers to accept new subscriptions to events. This will also make the unsubscribe useful.
  • Generalise subscriptions using generics, which would enable a subscription to add to the correct handler slice.

Examples

The examples folder illustrates some use cases.

eventgoround's People

Contributors

tanerius avatar

Watchers

 avatar  avatar

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.