Skip to content

Instantly share code, notes, and snippets.

@raine
Created May 26, 2013 13:14
Show Gist options
  • Select an option

  • Save raine/5652753 to your computer and use it in GitHub Desktop.

Select an option

Save raine/5652753 to your computer and use it in GitHub Desktop.
this.listenTo(app.settings, 'change', this.refresh.bind(this, 'cache'));
refresh: function(arg) {
var type;
if (arg === 'cache') {
// HACK: 'change' fires twice on settings when resetting,
// once from resetting to defaults and again from setting the
// topics. This makes sure that refresh is called only once
// when resetting.
if (app.settings.get('topics') === undefined) {
return;
}
type = 'refresh-from-cache';
} else {
type = 'refresh';
}
chrome.extension.sendMessage({
type: type
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment