New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins #58
Conversation
Looks good at a glance so far. Is there a way to remove listeners, or |
Great idea, I'll add it in |
Alright, I found a solution I'm pretty happy with. I've added a new Plugin architecture using the Interceptor Pattern that will allow multiple plugins to register functions on the same Kontra object function. I've also added a way to safely extend a Kontra object with new properties without overriding ones that may have been extend already. |
Here's a draft of what I'm thinking for the plugin architecture. It's just a simple pub/sub architecture that should let anyone subscribe to certain lifecycle events and do what they need from there.
So for example, both
kontra.vector
andkontra.sprite
emitinit
events that plugins to can use to attach new functionality such as advanced vector functions or auto collision detection for different sprite shapes.What do you think @BoldBigflank, @jaronwanderley, @Quentie?