1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-21 09:55:47 +01:00

Hello strange new syntax. Can we be friends?

This commit is contained in:
Kris Maglione
2013-08-21 22:55:55 -07:00
parent e5864bfd23
commit c89f3e0df5
21 changed files with 106 additions and 134 deletions

View File

@@ -167,11 +167,11 @@ var CommandWidgets = Class("CommandWidgets", {
function get(prefix, map, id) (obj.getElement || util.identity)(map[id] || document.getElementById(prefix + id));
this.active.__defineGetter__(obj.name, function () self.activeGroup[obj.name][obj.name]);
this.activeGroup.__defineGetter__(obj.name, function () self.getGroup(obj.name));
this.active.__defineGetter__(obj.name, () => this.activeGroup[obj.name][obj.name]);
this.activeGroup.__defineGetter__(obj.name, () => this.getGroup(obj.name));
memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
memoize(this.commandbar, obj.name, function () get("dactyl-", {}, (obj.id || obj.name)));
memoize(this.statusbar, obj.name, () => get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
memoize(this.commandbar, obj.name, () => get("dactyl-", {}, (obj.id || obj.name)));
if (!(obj.noValue || obj.getValue)) {
Object.defineProperty(this, obj.name, Modes.boundProperty({
@@ -504,8 +504,6 @@ var CommandPromptMode = Class("CommandPromptMode", CommandMode, {
*/
var CommandLine = Module("commandline", {
init: function init() {
const self = this;
this._callbacks = {};
memoize(this, "_store", function () storage.newMap("command-history", { store: true, privateData: true }));
@@ -777,13 +775,12 @@ var CommandLine = Module("commandline", {
highlightGroup = highlightGroup || this.HL_NORMAL;
let self = this;
function appendToMessages(data) {
let appendToMessages = (data) => {
let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data };
// Make sure the memoized message property is an instance property.
message.message;
self._messageHistory.add(update({ highlight: highlightGroup }, message));
this._messageHistory.add(update({ highlight: highlightGroup }, message));
return message.message;
}
@@ -802,7 +799,7 @@ var CommandLine = Module("commandline", {
if ((flags & this.FORCE_MULTILINE) || (/\n/.test(data) || !isinstance(data, [_, "String"])) && !(flags & this.FORCE_SINGLELINE))
action = mow.closure.echo;
let checkSingleLine = function () action == self._echoLine;
let checkSingleLine = () => action == this._echoLine;
if (forceSingle) {
this._lastEcho = null;

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -250,18 +250,17 @@ var KeyProcessor = Class("KeyProcessor", {
},
execute: function execute(map, args)
let (self = this)
function execute() {
if (self.preExecute)
self.preExecute.apply(self, args);
() => {
if (this.preExecute)
this.preExecute.apply(this, args);
args.self = self.main.params.mappingSelf || self.main.mappingSelf || map;
let res = map.execute.call(map, args);
args.self = this.main.params.mappingSelf || this.main.mappingSelf || map;
let res = map.execute.call(map, args);
if (self.postExecute)
self.postExecute.apply(self, args);
return res;
},
if (this.postExecute)
this.postExecute.apply(this, args);
return res;
},
onKeyPress: function onKeyPress(event) {
if (event.skipmap)

View File

@@ -123,8 +123,7 @@ var Map = Class("Map", {
contexts.context,
args);
let self = this;
function repeat() self.action(args)
let repeat = () => this.action(args);
if (this.names[0] != ".") // FIXME: Kludge.
mappings.repeat = repeat;