mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-11 23:24:43 +02:00
* New concept of saved states. Modules will be called before enter to restore a saved state (if applicable) and before leave to save one.
This commit is contained in:
parent
9865da34cc
commit
1b46506cf8
3 changed files with 38 additions and 1 deletions
|
@ -394,9 +394,13 @@ function Client(input, output) {
|
|||
|
||||
self.detachCurrentMenuModule = function() {
|
||||
if(self.currentMenuModule) {
|
||||
|
||||
var savedState = self.currentMenuModule.getSaveState();
|
||||
|
||||
self.currentMenuModule.leave();
|
||||
|
||||
self.lastMenuModuleInfo = self.currentMenuModuleInfo;
|
||||
self.lastMenuModuleInfo = self.currentMenuModuleInfo;
|
||||
self.lastMenuModuleInfo.savedState = savedState;
|
||||
|
||||
self.currentMenuModule = null;
|
||||
}
|
||||
|
@ -463,6 +467,10 @@ Client.prototype.gotoMenuModule = function(options, cb) {
|
|||
extraArgs : options.extraArgs,
|
||||
}
|
||||
|
||||
if(options.savedState) {
|
||||
modInst.restoreSavedState(options.savedState);
|
||||
}
|
||||
|
||||
modInst.enter(self);
|
||||
|
||||
if(!callbackOnErrorOnly) {
|
||||
|
@ -479,6 +487,7 @@ Client.prototype.fallbackMenuModule = function(cb) {
|
|||
var modOpts = {
|
||||
name : self.lastMenuModuleInfo.menuName,
|
||||
extraArgs : self.lastMenuModuleInfo.extraArgs,
|
||||
savedState : self.lastMenuModuleInfo.savedState,
|
||||
};
|
||||
|
||||
self.gotoMenuModule(modOpts, cb);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue