What is the usual way for a module to notify applications when a change event arrives? Should privateClient be exposed in exports, so applications can write
privateClient.on(‘change’, evt => {})
Or should a subscribe method be exposed in exports, which calls privateClient.on() with the passed function?
I’m currently having the module export a subscribe(callback) function. That prevents apps from calling privateClient.storeObject() directly. (Of course, apps can fork the module or not use it and write whatever they like, but at that point, they are clearly not following the rules.)