Update MenuFlags to work as expected
* 'popParent' has been removed * 'noHistory' now works as expected * Mods that explicitly want noHistory can state such in their constructor()
This commit is contained in:
@@ -20,6 +20,23 @@ const assert = require('assert');
|
||||
const _ = require('lodash');
|
||||
const iconvDecode = require('iconv-lite').decode;
|
||||
|
||||
const MenuFlags = {
|
||||
// When leaving this menu to load/chain to another, remove this
|
||||
// menu from history. In other words, the fallback from
|
||||
// the next menu would *not* be this one, but the previous.
|
||||
NoHistory: 'noHistory',
|
||||
|
||||
// Generally used in code only: Request that any flags from menu.hjson
|
||||
// are merged in to the total set of flags vs overriding the default.
|
||||
MergeFlags: 'mergeFlags',
|
||||
|
||||
// Forward this menu's 'extraArgs' to the next.
|
||||
ForwardArgs: 'forwardArgs',
|
||||
};
|
||||
|
||||
exports.MenuFlags = MenuFlags;
|
||||
|
||||
|
||||
exports.MenuModule = class MenuModule extends PluginModule {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
@@ -48,6 +65,11 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
||||
});
|
||||
}
|
||||
|
||||
setMergedFlag(flag) {
|
||||
this.menuConfig.config.menuFlags.push(flag);
|
||||
this.menuConfig.config.menuFlags = [...new Set([...this.menuConfig.config.menuFlags, MenuFlags.MergeFlags])];
|
||||
}
|
||||
|
||||
static get InterruptTypes() {
|
||||
return {
|
||||
Never: 'never',
|
||||
|
||||
Reference in New Issue
Block a user