Functions to remove all/certain event or hook subscriptions
Closed this issue · 1 comments
Hello,
I'm currently trying to develop an extension to run a shell command based on events/hooks. Personally I'd only like to automatically process finished bundles, i.e. move the bundle to a specific location based on the content. But as someone might find it useful, I thought I'd make it a generalized "when a certain event occurs, run a shell command" extension with the feature to use event values as parameters for the command. Basically the configuration would look like this:
Now the problem with this concept is that if I interpreted the code right (which could be completely off, because this is my first (Node) JS porject ever) there is no function to remove a subcribtion to an event or a hook. So the extension would have to be restarted after every conifguration change, although "onValuesUpdated" could easily be used to subscribe to the configured events/hooks.
That's an interesting concept.
It's actually possible to remove individual subscriptions already. Please see the example at https://github.com/airdcpp-web/airdcpp-apisocket-js/blob/master/GUIDE.md#addlistener
addListener
and addHook
will both return a callback function after the subscription has been added in the application, which can be used to remove the subscription. You can store individual removal callbacks somewhere and execute them when needed.