Skip to content

Instantly share code, notes, and snippets.

@justinvdm
Last active October 18, 2016 15:35
Show Gist options
  • Save justinvdm/4fa60408044bf66eb1ae8dbd38e8a49c to your computer and use it in GitHub Desktop.
Save justinvdm/4fa60408044bf66eb1ae8dbd38e8a49c to your computer and use it in GitHub Desktop.
var PaginatedExtended = PaginatedState.extend(function(self, name, opts) {
PaginatedState.call(self, name, opts);
self.choices.try_again = 'Try again';
self.on('state:input', function(e) {
var content = (e.content || '').trim();
var choice = self._current_choices[+content - 1];
if (choice == 'try_again') {
// DO STUFF HERE
}
});
var super_determine_choices = self._determine_choices;
self._determine_choices = function(first, last) {
var choices = super_determine_choices(first, last);
choices.push('try_again');
return choices;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment