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

Make hook signature more open #5

Merged
merged 2 commits into from Oct 3, 2017

Conversation

2 participants
@yohanboniface
Member

yohanboniface commented Sep 26, 2017

Third-party extensions/users may use hooks for their own needs.

An example is utilery: https://github.com/tilery/utilery/blob/async/utilery/core.py#L70

@yohanboniface yohanboniface requested a review from davidbgk Sep 26, 2017

@davidbgk

We should document it in a How-to with a concrete example

Make hook signature more open
Third-party extensions/users may use hooks for their own needs.
docs/index.md Outdated
@@ -60,7 +60,8 @@ A how-to guide:
* [How to return JSON content](how-to-guides.md#how-to-return-json-content)
* [How to subclass Roll itself](how-to-guides.md#how-to-subclass-roll-itself)
* [How to deploy Roll into production](how-to-guides.md#how-to-deploy-roll-into-production)
* [How to run Roll’s tests](how-to-guides.md##how-to-run-rolls-tests)
* [How to run Roll’s tests](how-to-guides.md#how-to-run-rolls-tests)
* [How to send custom events](how-to-guides.md#how-to-use-custom-events)

This comment has been minimized.

@davidbgk

davidbgk Sep 26, 2017

Contributor

send (here) or use as a title of the How-to page?

This comment has been minimized.

@yohanboniface
docs/how-to-guides.md Outdated
## How to use custom events
Roll as a very small API for listening and sending event. It's possible to use

This comment has been minimized.

@davidbgk

davidbgk Sep 26, 2017

Contributor

has*

This comment has been minimized.

@yohanboniface
docs/how-to-guides.md Outdated
app = Roll()
@app.listen('myevent')
def listener(myarg):

This comment has been minimized.

@davidbgk

davidbgk Sep 26, 2017

Contributor

What would be a real use-case? Sending emails? Filling metrics?

This comment has been minimized.

@yohanboniface

yohanboniface Oct 2, 2017

Member

Added a more realistic use case. :)

docs/how-to-guides.md Outdated
Roll has a very small API for listening and sending events. It's possible to use
it in your project for your own events.
Events are useful when you want other user to extend your own code, whether

This comment has been minimized.

@davidbgk

davidbgk Oct 2, 2017

Contributor

s/user/users/

docs/how-to-guides.md Outdated
For example, say we develop a DB pooling extension for Roll. We
would use a simple configuration parameter to let users change the connection
credentials (host, username, password…). But if we want users run some

This comment has been minimized.

@davidbgk

davidbgk Oct 2, 2017

Contributor

s/run/to run/

This comment has been minimized.

@yohanboniface

@yohanboniface yohanboniface merged commit 54a1a72 into master Oct 3, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@yohanboniface yohanboniface deleted the hook-signature branch Oct 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment