Skip to content
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

Merged
merged 11 commits into from Feb 23, 2019
Merged

Plugins #58

merged 11 commits into from Feb 23, 2019

Conversation

straker
Copy link
Owner

@straker straker commented Feb 18, 2019

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 and kontra.sprite emit init 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?

@coveralls
Copy link

coveralls commented Feb 18, 2019

Coverage Status

Coverage increased (+0.1%) to 98.738% when pulling 5e7f75c on plugins into f4896a3 on v6.

@BoldBigflank
Copy link
Contributor

Looks good at a glance so far. Is there a way to remove listeners, or off, for loading/unloading many instances.

@straker
Copy link
Owner Author

straker commented Feb 20, 2019

Great idea, I'll add it in

@straker
Copy link
Owner Author

straker commented Feb 22, 2019

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.

@straker straker added this to the v6 milestone Feb 23, 2019
@straker straker changed the base branch from master to v6 February 23, 2019 19:37
@straker straker merged commit 403e023 into v6 Feb 23, 2019
@straker straker deleted the plugins branch February 23, 2019 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants