mesg-foundation / js-sdk

Javascript mono-repo with all the tools to interact with MESG
https://mesg.com
4 stars 4 forks source link

Make whenEvent and whenResult task parameter optional #77

Closed NicolasMahe closed 4 years ago

NicolasMahe commented 6 years ago

Right now it's very hard to debug the whenEvent and whenResult.

The solution is to make the parameter task of these previous function optional in order to use them like:

MESG.whenEvent(eventObject)
.on('data', function(data) {
  // Debug mode
})

The lib should detect this utilization and output in the warning log a message explaining that it should be use only for debug purpose, should not be used in production, and the developer should create a service instead with a link to the doc.

NicolasMahe commented 6 years ago

Related to https://github.com/mesg-foundation/mesg-js/issues/10