Let's take this really simple service example
name: example
events:
eventX:
data: {}
tasks:
start:
inputs:
isValid:
type: Boolean
outputs:
valid:
data: {}
error:
data: {}
const MESG = require('mesg/service')
const start = ({ isValid }, { valid, error }) => isValid
? valid({})
: error({})
MESG.listenTask({ start })
const MESG = require('mesg/service')
MESG.emitEvent("eventX", {
foo: "bar"
}).then(...)