Re-implement ExecuteHooks in terms of the Hooks object (since it was documented, I guess we shouldn't remove it, even though I doubt anyone has used it)

This commit is contained in:
Davide P. Cervone 2011-12-27 14:55:20 -05:00
parent ae48b1fd8b
commit 752dda7899
2 changed files with 16 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -366,7 +366,7 @@ MathJax.fileversion = "1.1.17";
}; };
// //
// An array or priorities hooks that are executed sequentially // An array of priorities hooks that are executed sequentially
// with a given set of data. // with a given set of data.
// //
var HOOKS = MathJax.Object.Subclass({ var HOOKS = MathJax.Object.Subclass({
@ -412,6 +412,19 @@ MathJax.fileversion = "1.1.17";
} }
}); });
//
// Run an array of callbacks passing them the given data.
// (Legacy function, since this has been replaced by the HOOKS object).
//
var EXECUTEHOOKS = function (hooks,data,reset) {
if (!hooks) {return null}
if (!(hooks instanceof Array)) {hooks = [hooks]}
if (!(data instanceof Array)) {data = (data == null ? [] : [data])}
var handler = HOOKS(reset);
for (var i = 0, m = hooks.length; i < m; i++) {handler.Add(hooks[i])}
return handler.Execute.apply(handler,data);
};
// //
// Command queue that performs commands in order, waiting when // Command queue that performs commands in order, waiting when
// necessary for commands to complete asynchronousely // necessary for commands to complete asynchronousely
@ -574,6 +587,7 @@ MathJax.fileversion = "1.1.17";
BASE.Callback.Queue = QUEUE; BASE.Callback.Queue = QUEUE;
BASE.Callback.Signal = SIGNAL.find; BASE.Callback.Signal = SIGNAL.find;
BASE.Callback.Hooks = HOOKS; BASE.Callback.Hooks = HOOKS;
BASE.Callback.ExecuteHooks = EXECUTEHOOKS;
})("MathJax"); })("MathJax");
/**********************************************************/ /**********************************************************/