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
Added plugin infrastructure #16
base: develop
Are you sure you want to change the base?
Conversation
I think the event structure is fine, of course there are always a lot of ways of doing this, but my first impression is that your approach is clean and well structured. Maybe the IEvent interface is not really needed now (and maybe never will), so one could question it, but by thinking over it again I would stick to it because it keeps us flexible and doesn't hurt us... I would prefer wait for a stable typescript compiler before merging the pull request, since it could cause some troubles and we don't need it right now. So I would suggest we come back to this in 2 weeks and see if things have changed and discuss it again (and make the final code reviews then). |
Btw, pasted in from #1
Waiting for a stable compiler is fine for me, I just thought you needed this quite soon? Re |
The npm package was much more important and opened the doors for many days of happy coding. We will need the event structure, and hopefully soon, but since I'm alone in the AA project right now (there also popped up some unexpected tasks) and also involved to the other projects, I think we still have some time and can postpone this task for now (as I said, maybe 2 weeks or so) |
7adcc7f
to
0621bbb
Compare
…r Plugin. #1 Signed-off-by: Sebastian Haas <sebastian@haas.tech>
Signed-off-by: Sebastian Haas <sebastian@haas.tech>
Signed-off-by: Sebastian Haas <sebastian@haas.tech>
01b1f42
to
50f7a32
Compare
9b4a2fa
to
a64b76e
Compare
See #1 for general information about the idea behind this PR.
I created a plugin infrastructure for OSMD as discussed in #1.
Why
How
Event
(IEvent
) to represent a generic OSMD event that can hold a generically typed argument.IEventSource
.IPlugin
interface,(currentlyMusicSheetAPI
)Obvious questions
Using an interface, the subscribing plugin has to implement and handle all possible events, which can be quite a lot. I turned this around, so the plugin can register on only those events it is interested in.
I needed to use
chai-spies
for testing the event infrastructure, and due to a limitation in the current typescript version, it is not possible to use the typings for that.tslint
is just in a dev channel because it depends on typescript. I would love to remove this limitation before merging this PR and use a stable typescript compiler! typings/registry#545I don't know really. Maybe because it keeps it modular and maybe one day we have a different way to instantiate an OSMD other than via
MusicSheetAPI
. It also keepsMusicSheetAPI
cleaner and more focused on its actual purpose.Open issues
IEvent
(see discussion below)- [ ] Code review by @acondolu