Skip to content

Decision to use node cb style for lifecycle hooks #176

Closed
@clark-pan

Description

@clark-pan

Is there a specific reason why you chose to use the nodejs cb style for the lifecycle hook functions?

Since we've got promises anyways, and internally it seems like you convert them into promises (by decorating $q, which isn't a very good idea) why not just wrap the return value in a $q.when?

So instead of:

promise
  .then(function (attrs) {
    return DS.$q.promisify(definition.beforeValidate)(resourceName, attrs);
  })

why not:

promise
  .then(function(attrs){
    return definition.beforeValidate(resourceName, attrs);
  })

It would provide consistency in within the library and application code in how async is handled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions