Minor cleanup work

This commit is contained in:
Bryan Ashby 2016-07-19 21:01:49 -06:00
parent 5e13a78f31
commit 2d1f3d3c17
1 changed files with 13 additions and 5 deletions

View File

@ -71,10 +71,18 @@ MenuStack.prototype.next = function(cb) {
MenuStack.prototype.prev = function(cb) { MenuStack.prototype.prev = function(cb) {
this.pop().instance.leave(); // leave & remove current this.pop().instance.leave(); // leave & remove current
var previousModuleInfo = this.pop(); // get previous
const previousModuleInfo = this.pop(); // get previous
if(previousModuleInfo) { if(previousModuleInfo) {
this.goto(previousModuleInfo.name, { extraArgs : previousModuleInfo.extraArgs, savedState : previousModuleInfo.savedState }, cb); this.goto(
previousModuleInfo.name,
{
extraArgs : previousModuleInfo.extraArgs,
savedState : previousModuleInfo.savedState
},
cb
);
} else { } else {
cb(new Error('No previous menu available!')); cb(new Error('No previous menu available!'));
} }
@ -87,7 +95,7 @@ MenuStack.prototype.goto = function(name, options, cb) {
cb = options; cb = options;
} }
var self = this; const self = this;
if(currentModuleInfo && name === currentModuleInfo.name) { if(currentModuleInfo && name === currentModuleInfo.name) {
if(cb) { if(cb) {
@ -96,7 +104,7 @@ MenuStack.prototype.goto = function(name, options, cb) {
return; return;
} }
var loadOpts = { const loadOpts = {
name : name, name : name,
client : self.client, client : self.client,
}; };
@ -107,7 +115,7 @@ MenuStack.prototype.goto = function(name, options, cb) {
loadMenu(loadOpts, function menuLoaded(err, modInst) { loadMenu(loadOpts, function menuLoaded(err, modInst) {
if(err) { if(err) {
var errCb = cb || self.client.defaultHandlerMissingMod(); const errCb = cb || self.client.defaultHandlerMissingMod();
errCb(err); errCb(err);
} else { } else {
// :TODO: Move this log to caller // :TODO: Move this log to caller