Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Refactoring for hooks to use promises and promise chains #29

Merged
merged 1 commit into from
Jan 12, 2016

Conversation

daffl
Copy link
Member

@daffl daffl commented Jan 12, 2016

This pull request is a larger refactoring that allows service methods that return promises and turns hooks into promise chains. They can now also be used like this:

app.service('todos').before({
  create(hook) {
    if(!hook.data.text) {
      throw new Error('Text has to be provided');
    }

    hook.data.text = data.text.substring(0, 255);
  }
});

Closes #28

@ekryski
Copy link
Member

ekryski commented Jan 12, 2016

:shipit:

ekryski added a commit that referenced this pull request Jan 12, 2016
Refactoring for hooks to use promises and promise chains
@ekryski ekryski merged commit b3baa30 into master Jan 12, 2016
@ekryski ekryski deleted the promises-28 branch January 12, 2016 04:16
@marshallswain
Copy link
Member

Wow. This really made hooks really clean.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants