Created
March 30, 2015 18:42
-
-
Save jkneal/53cecc2e711c4c84e540 to your computer and use it in GitHub Desktop.
Add onUpdate events to easy cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render():ReactElement { | |
var cid = this.getParams().cid | |
var config = this.config() | |
this.saveCourse(this.course().value) // We shouldn't do this on render. It also saves on window resize. | |
return ( | |
<Layout cursor={this.cursor()} config={config} mode={EDIT}> | |
<EditOptions cid={cid}/> | |
</Layout> | |
) | |
} | |
saveCourse(course:Course):void { | |
... | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidMount() { | |
this.cursor().onUpdate(this.saveCourse) | |
} | |
// onUpdate handler gets passed the current cursor value, in this case the course | |
saveCourse(course:Course):void { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, I like this idea. Any idea how much it would take to implement?