Last active
October 18, 2016 15:35
-
-
Save justinvdm/4fa60408044bf66eb1ae8dbd38e8a49c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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