mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 22:17:59 +01:00
Normalise the use of "func" vs "fn" for function references.
"func" had the numbers.
This commit is contained in:
@@ -125,9 +125,9 @@ function Buffer() //{{{
|
||||
|
||||
// Holds option: [function, title] to generate :pageinfo sections
|
||||
var pageInfo = {};
|
||||
function addPageInfoSection(option, title, fn)
|
||||
function addPageInfoSection(option, title, func)
|
||||
{
|
||||
pageInfo[option] = [fn, title];
|
||||
pageInfo[option] = [func, title];
|
||||
}
|
||||
|
||||
function openUploadPrompt(elem)
|
||||
@@ -1013,7 +1013,7 @@ function Buffer() //{{{
|
||||
* @param {string} option The section's value in 'pageinfo'.
|
||||
* @param {string} title The heading for this section's
|
||||
* output.
|
||||
* @param {function} fn The function to generate this
|
||||
* @param {function} func The function to generate this
|
||||
* section's output.
|
||||
*/
|
||||
addPageInfoSection: addPageInfoSection,
|
||||
|
||||
@@ -1181,24 +1181,24 @@ lookup:
|
||||
|
||||
/**
|
||||
* Creates a temporary file context for executing external commands.
|
||||
* <b>fn</b> is called with a temp file, created with
|
||||
* <b>func</b> is called with a temp file, created with
|
||||
* {@link #createTempFile}, for each explicit argument. Ensures that
|
||||
* all files are removed when <b>fn</b> returns.
|
||||
* all files are removed when <b>func</b> returns.
|
||||
*
|
||||
* @param {function} fn The function to execute.
|
||||
* @param {Object} self The 'this' object used when executing fn.
|
||||
* @param {function} func The function to execute.
|
||||
* @param {Object} self The 'this' object used when executing func.
|
||||
* @returns {boolean} false if temp files couldn't be created,
|
||||
* otherwise, the return value of <b>fn</b>.
|
||||
* otherwise, the return value of <b>func</b>.
|
||||
*/
|
||||
withTempFiles: function (fn, self)
|
||||
withTempFiles: function (func, self)
|
||||
{
|
||||
let args = util.map(util.range(0, fn.length), this.createTempFile);
|
||||
let args = util.map(util.range(0, func.length), this.createTempFile);
|
||||
if (!args.every(util.identity))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
return fn.apply(self || this, args);
|
||||
return func.apply(self || this, args);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -724,8 +724,8 @@ const liberator = (function () //{{{
|
||||
triggerObserver: function (type)
|
||||
{
|
||||
let args = Array.slice(arguments, 1);
|
||||
for (let [,fn] in Iterator(observers[type] || []))
|
||||
fn.apply(null, args);
|
||||
for (let [,func] in Iterator(observers[type] || []))
|
||||
func.apply(null, args);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1353,22 +1353,22 @@ function Options() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* Executes <b>fn</b> with a new preference context. When <b>fn</b>
|
||||
* Executes <b>func</b> with a new preference context. When <b>func</b>
|
||||
* returns, the context is popped and any preferences set via
|
||||
* {@link #setPref} or {@link #invertPref} are restored to their
|
||||
* previous values.
|
||||
*
|
||||
* @param {function} fn The function to call.
|
||||
* @param {Object} fn The 'this' object with which to call <b>fn</b>
|
||||
* @param {function} func The function to call.
|
||||
* @param {Object} func The 'this' object with which to call <b>func</b>
|
||||
* @see #pushContext
|
||||
* @see #popContext
|
||||
*/
|
||||
withContext: function (fn, self)
|
||||
withContext: function (func, self)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.pushContext();
|
||||
return fn.call(self);
|
||||
return func.call(self);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ const template = { //{{{
|
||||
add: function add(a, b) a + b,
|
||||
join: function join(c) function (a, b) a + c + b,
|
||||
|
||||
map: function map(iter, fn, sep, interruptable)
|
||||
map: function map(iter, func, sep, interruptable)
|
||||
{
|
||||
if (iter.length) // FIXME: Kludge?
|
||||
iter = util.Array.itervalues(iter);
|
||||
@@ -20,7 +20,7 @@ const template = { //{{{
|
||||
let n = 0;
|
||||
for each (let i in Iterator(iter))
|
||||
{
|
||||
let val = fn(i);
|
||||
let val = func(i);
|
||||
if (val == undefined)
|
||||
continue;
|
||||
if (sep && n++)
|
||||
|
||||
@@ -1039,13 +1039,13 @@ function CommandLine() //{{{
|
||||
});
|
||||
},
|
||||
|
||||
runSilently: function (fn, self)
|
||||
runSilently: function (func, self)
|
||||
{
|
||||
let wasSilent = this.silent;
|
||||
this.silent = true;
|
||||
try
|
||||
{
|
||||
fn.call(self);
|
||||
func.call(self);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -372,18 +372,18 @@ const util = { //{{{
|
||||
}),
|
||||
|
||||
/**
|
||||
* Returns the array that results from applying <b>fn</b> to each property
|
||||
* of <b>obj</b>.
|
||||
* Returns the array that results from applying <b>func</b> to each
|
||||
* property of <b>obj</b>.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @param {function} fn
|
||||
* @param {function} func
|
||||
* @returns {Array}
|
||||
*/
|
||||
map: function map(obj, fn)
|
||||
map: function map(obj, func)
|
||||
{
|
||||
let ary = [];
|
||||
for (let i in Iterator(obj))
|
||||
ary.push(fn(i));
|
||||
ary.push(func(i));
|
||||
return ary;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user