I would like to provide an easy way for users to change the default behavior of a function in a package I’m writing. The main idea is to provide users with a way to preprocess a block of text before my package processes it. There are packages out there that do it but I don’t really understand how. I know a few things but I’m not well versed in [Java|Coffee]Script or in all things async.
I read about services. Those seems to require that a user write another package to consume them. It wasn’t clear to me from the docs and looking at packages that provide services whether
- services allow users to change the behavior of a package, or
- users can consume services without writing a package (e.g., from the
As an alternative, I tried emitting events in my package that users can subscribe to (in
init) to implement some functionality and return results via a callback. That looks viable but I ran into errors here too.
I’m happy to show code excerpts to illustrate what I’ve tried but I was wondering whether there’s an obvious way to accomplish what I’m after. A simple example would greatly help. Google and the flight manual haven’t provided much help.