1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 17:27:59 +01:00

Normalise the use of "func" vs "fn" for function references.

"func" had the numbers.
This commit is contained in:
Doug Kearns
2009-06-28 22:34:22 +10:00
parent 3628ff8803
commit e2e31528e2
7 changed files with 27 additions and 27 deletions

View File

@@ -125,9 +125,9 @@ function Buffer() //{{{
// Holds option: [function, title] to generate :pageinfo sections // Holds option: [function, title] to generate :pageinfo sections
var pageInfo = {}; var pageInfo = {};
function addPageInfoSection(option, title, fn) function addPageInfoSection(option, title, func)
{ {
pageInfo[option] = [fn, title]; pageInfo[option] = [func, title];
} }
function openUploadPrompt(elem) function openUploadPrompt(elem)
@@ -1013,7 +1013,7 @@ function Buffer() //{{{
* @param {string} option The section's value in 'pageinfo'. * @param {string} option The section's value in 'pageinfo'.
* @param {string} title The heading for this section's * @param {string} title The heading for this section's
* output. * output.
* @param {function} fn The function to generate this * @param {function} func The function to generate this
* section's output. * section's output.
*/ */
addPageInfoSection: addPageInfoSection, addPageInfoSection: addPageInfoSection,

View File

@@ -1181,24 +1181,24 @@ lookup:
/** /**
* Creates a temporary file context for executing external commands. * 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 * {@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 {function} func The function to execute.
* @param {Object} self The 'this' object used when executing fn. * @param {Object} self The 'this' object used when executing func.
* @returns {boolean} false if temp files couldn't be created, * @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)) if (!args.every(util.identity))
return false; return false;
try try
{ {
return fn.apply(self || this, args); return func.apply(self || this, args);
} }
finally finally
{ {

View File

@@ -724,8 +724,8 @@ const liberator = (function () //{{{
triggerObserver: function (type) triggerObserver: function (type)
{ {
let args = Array.slice(arguments, 1); let args = Array.slice(arguments, 1);
for (let [,fn] in Iterator(observers[type] || [])) for (let [,func] in Iterator(observers[type] || []))
fn.apply(null, args); func.apply(null, args);
}, },
/** /**

View File

@@ -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 * returns, the context is popped and any preferences set via
* {@link #setPref} or {@link #invertPref} are restored to their * {@link #setPref} or {@link #invertPref} are restored to their
* previous values. * previous values.
* *
* @param {function} fn The function to call. * @param {function} func The function to call.
* @param {Object} fn The 'this' object with which to call <b>fn</b> * @param {Object} func The 'this' object with which to call <b>func</b>
* @see #pushContext * @see #pushContext
* @see #popContext * @see #popContext
*/ */
withContext: function (fn, self) withContext: function (func, self)
{ {
try try
{ {
this.pushContext(); this.pushContext();
return fn.call(self); return func.call(self);
} }
finally finally
{ {

View File

@@ -12,7 +12,7 @@ const template = { //{{{
add: function add(a, b) a + b, add: function add(a, b) a + b,
join: function join(c) function (a, b) a + c + 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? if (iter.length) // FIXME: Kludge?
iter = util.Array.itervalues(iter); iter = util.Array.itervalues(iter);
@@ -20,7 +20,7 @@ const template = { //{{{
let n = 0; let n = 0;
for each (let i in Iterator(iter)) for each (let i in Iterator(iter))
{ {
let val = fn(i); let val = func(i);
if (val == undefined) if (val == undefined)
continue; continue;
if (sep && n++) if (sep && n++)

View File

@@ -1039,13 +1039,13 @@ function CommandLine() //{{{
}); });
}, },
runSilently: function (fn, self) runSilently: function (func, self)
{ {
let wasSilent = this.silent; let wasSilent = this.silent;
this.silent = true; this.silent = true;
try try
{ {
fn.call(self); func.call(self);
} }
finally finally
{ {

View File

@@ -372,18 +372,18 @@ const util = { //{{{
}), }),
/** /**
* Returns the array that results from applying <b>fn</b> to each property * Returns the array that results from applying <b>func</b> to each
* of <b>obj</b>. * property of <b>obj</b>.
* *
* @param {Object} obj * @param {Object} obj
* @param {function} fn * @param {function} func
* @returns {Array} * @returns {Array}
*/ */
map: function map(obj, fn) map: function map(obj, func)
{ {
let ary = []; let ary = [];
for (let i in Iterator(obj)) for (let i in Iterator(obj))
ary.push(fn(i)); ary.push(func(i));
return ary; return ary;
}, },