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

WIP: feature hookable #455

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

artemgurzhii
Copy link
Contributor

@artemgurzhii artemgurzhii commented May 3, 2019

Issue

TODO:

  • @san650 Is API ok?
  • Add support for the async before and after hooks?
  • Tests
  • Docs

@san650 Is there any other use cases that I need to make sure works correctly?

For what I see, the use case only exists for the clickable/fillable functions, but with this API it can be used with all functions passing functions as hooks

@artemgurzhii
Copy link
Contributor Author

I'll proceed once we resolve all questions and API is approved

@ming-codes
Copy link

I've been looking for a feature like this. It's great for adding before and after assertions on the action. Hope we can move forward with this.

@artemgurzhii
Copy link
Contributor Author

@san650 What's your thoughts on this?

@san650
Copy link
Owner

san650 commented Oct 4, 2019

@artemgurzhii I think its a great! I would love to see this feature in master. Can you rebase and fix the tests? CI is failing

@artemgurzhii
Copy link
Contributor Author

@san650 sure, I will work on it during those weekends and hope this will be ready by Monday.

What about the second question? Do you think there is any possible use case for the async hooks?

@san650
Copy link
Owner

san650 commented Oct 4, 2019

@artemgurzhii

@san650 Is there any other use cases that I need to make sure works correctly?

No that I can think of, but I'll let you know if something comes to mi mind.

Thanks!!

const fn = descriptor.get.call(this, key);

return function() {
// Async before and after hooks? Any use case for that?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe async should be a first class citizen cause events/actions often cause async jobs. So you probably typically want to give validations to re-compute after you blur an input.

Not sure whether we want to support sync.. Are there any exampes for sync behavior?


return function() {
// Async before and after hooks? Any use case for that?
hooks.before();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be invoked the same way fn.call(this, ...args) does, otherwise it's doesn't seem to be useful, cause no access to the current node instance on which it was invoked,..

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 98.283% when pulling 64d0023 on artemgurzhii:feature/hookable into 1dac34d on san650:master.

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

Successfully merging this pull request may close these issues.

5 participants