Skip to content

Instantly share code, notes, and snippets.

@jkneal
Created March 30, 2015 18:42
Show Gist options
  • Save jkneal/53cecc2e711c4c84e540 to your computer and use it in GitHub Desktop.
Save jkneal/53cecc2e711c4c84e540 to your computer and use it in GitHub Desktop.
Add onUpdate events to easy cursor
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 {
...
}
componentDidMount() {
this.cursor().onUpdate(this.saveCourse)
}
// onUpdate handler gets passed the current cursor value, in this case the course
saveCourse(course:Course):void {
...
}
@mrmurphy
Copy link

mrmurphy commented Apr 1, 2015

Yeah, I like this idea. Any idea how much it would take to implement?

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