1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-22 11:15:47 +01:00

Make further use of default parameters.

--HG--
extra : rebase_source : ab666bce7ed7e47c8f1e2bc4145f553da990d319
This commit is contained in:
Doug Kearns
2013-10-06 22:33:59 +11:00
parent cf7e0c479d
commit 4872666ef5
18 changed files with 49 additions and 85 deletions

View File

@@ -538,13 +538,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* @param {boolean} silent Whether the command should be echoed on the
* command line.
*/
execute: function execute(str, modifiers, silent) {
execute: function execute(str, modifiers = {}, silent = false) {
// skip comments and blank lines
if (/^\s*("|$)/.test(str))
return;
modifiers = modifiers || {};
if (!silent)
commands.lastCommand = str.replace(/^\s*:\s*/, "");
let res = true;
@@ -892,7 +890,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* tabs.
* @returns {boolean}
*/
open: function open(urls, params, force) {
open: function open(urls, params = {}, force = false) {
if (typeof urls == "string")
urls = dactyl.parseURLs(urls);
@@ -903,7 +901,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
dactyl.open(urls, params, true);
});
params = params || {};
if (isString(params))
params = { where: params };
@@ -1187,8 +1184,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
return [];
}
},
wrapCallback: function wrapCallback(callback, self) {
self = self || this;
wrapCallback: function wrapCallback(callback, self = this) {
let save = ["forceOpen"];
let saved = save.map(p => dactyl[p]);
return function wrappedCallback() {