Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Last active April 27, 2016 15:15
Show Gist options
  • Save beckettkev/d4b126950acba44fdf4698f0f37316bc to your computer and use it in GitHub Desktop.
Save beckettkev/d4b126950acba44fdf4698f0f37316bc to your computer and use it in GitHub Desktop.
setSearchFocus () {
if (this.refs['searchInput'] !== null) {
if (Golfish.interval !== null) {
window.clearInterval(Goldfish.interval);
}
//in the console check the value of this.refs['searchInput'];
this.refs['searchInput'].focus();
} else {
Goldfish.interval = Goldfish.interval || window.setInterval(function () {
this.setSearchFocus();
}, 1000);
}
},
componentDidMount () {
SearchStore.addChangeListener(this.onComponentChange.bind(this));
this.setSearchFocus.bind(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment