Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get return value from evt.post #10

Open
iShawnWang opened this issue Aug 9, 2020 · 6 comments
Open

Get return value from evt.post #10

iShawnWang opened this issue Aug 9, 2020 · 6 comments

Comments

@iShawnWang
Copy link

Any idea about get return value or complete callback after evt.post

@garronej
Copy link
Owner

garronej commented Aug 9, 2020

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?

@garronej
Copy link
Owner

@iShawnWang Would you please explain what you mean by "complete callback"?

@iShawnWang
Copy link
Author

iShawnWang commented Aug 16, 2020

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 ~

@garronej
Copy link
Owner

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 ~

🙏🙏

@iShawnWang
Copy link
Author

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

@garronej
Copy link
Owner

Ok, this is food for thought, I will investigate.
Thanks @iShawnWang

gitbook-com bot pushed a commit that referenced this issue Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants