summaryrefslogtreecommitdiffstats
path: root/client/lib/escapeActions.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/lib/escapeActions.js')
-rw-r--r--client/lib/escapeActions.js15
1 files changed, 5 insertions, 10 deletions
diff --git a/client/lib/escapeActions.js b/client/lib/escapeActions.js
index 3d08e2e3..1173dc46 100644
--- a/client/lib/escapeActions.js
+++ b/client/lib/escapeActions.js
@@ -17,25 +17,20 @@ EscapeActions = {
'sidebarView'
],
- register: function(label, action, condition, options) {
- condition = condition || function() { return true; };
- options = options || {};
-
- // XXX Rewrite this with ES6: .push({ priority, condition, action })
+ register: function(label, action, condition = () => true, options = {}) {
var priority = this.hierarchy.indexOf(label);
if (priority === -1) {
throw Error('You must define the label in the EscapeActions hierarchy');
}
this._actions.push({
- priority: priority,
- condition: condition,
- action: action,
+ priority,
+ condition,
+ action,
noClickEscapeOn: options.noClickEscapeOn,
enabledOnClick: !! options.enabledOnClick
});
- // XXX Rewrite this with ES6: => function
- this._actions = _.sortBy(this._actions, function(a) { return a.priority; });
+ this._actions = _.sortBy(this._actions, (a) => { return a.priority; });
},
executeLowest: function() {