Skip to content

Instantly share code, notes, and snippets.

@danderson00
Created June 14, 2017 19:00
Show Gist options
  • Save danderson00/21505b70c3908c87b5cd0f4613b3fbe4 to your computer and use it in GitHub Desktop.
Save danderson00/21505b70c3908c87b5cd0f4613b3fbe4 to your computer and use it in GitHub Desktop.
import throttle from 'webpack-worker/throttle.mostRecent'
// ...
componentDidMount = () => {
createClient(new Worker('/static/js/worker.bundle.js'), '/sp500hst.txt')
.then(client => {
this.worker = throttle.applyTo(client) // apply throttling to API requests
this.renderGraph(this.state.filter)
})
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment