evt
evt copied to clipboard
Get return value from evt.post
Any idea about get return value or complete callback after evt.post
Hi,
As of now evt.post
return post count... But I don't recall ever using the return value...
I am open to breaking changes, could you describe your use case and maybe make a suggestion on how to change the API?
@iShawnWang Would you please explain what you mean by "complete callback"?
I am not sure if this meet the design principle of evt
, maybe this meet my needs :
myEvt.post(params).then(returnValue => {
// other logic
})
The postCount
returnValue seems useless
Awesome library by the way ~
I am not sure if this meet the design principle of
evt
, maybe this meet my needs :myEvt.post(params).then(returnValue => { // other logic })
I was thinking about something like that.
When would you expect the then
callback to be invoked? When all handlers have been called?
What would you want the retrunValue
to be? The params
?
The
postCount
returnValue seems useless
Agreed
Awesome library by the way ~
🙏🙏
When would you expect the then callback to be invoked? When all handlers have been called? What would you want the retrunValue to be? The params ?
Wow, things seems more complex than i think !, I didn't take multiple subscriber into account.
In my opinion, the returnValue
shuold be the value returned in the evt.attach
.
If there are multiple evt.attch
for the same event, may be we can reference the design principle of webpack tappable
Ok, this is food for thought, I will investigate. Thanks @iShawnWang