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

Allow you to specify what the whens function context should inherit from... #184

Merged
merged 1 commit into from
Mar 8, 2015

Conversation

jhollingworth
Copy link
Contributor

When using when its really common to want to call component functions and/or other handlers. This PR allows that by creating a function context which has all the handlers on it but inherits from another context (if passed in) thus allowing both scenarios. Resolves #76

var Foo = React.createClass({
  render() {
    return this.foo.when({
      pending() {
        return this.done({})
      },
      failed(error) {
        return <Error error={error} />;
      },
      done(foo) {
        return <div className="Foo">{this.renderBody(foo)}</div>;
      }
    }, this);
  },
  renderBody(foo) {
    return <div className="Foo-body">{foo.bar}</div>;
  }
})

jhollingworth added a commit that referenced this pull request Mar 8, 2015
Allow you to specify what the whens function context should inherit from...
@jhollingworth jhollingworth merged commit 728e1ce into v0.9 Mar 8, 2015
@jhollingworth jhollingworth deleted the when-context branch March 8, 2015 19:17
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.

None yet

1 participant