| author | hamidouk |
| Fri, 23 Dec 2011 11:38:47 +0100 | |
| branch | jsdoc |
| changeset 520 | fe008e95a716 |
| permissions | -rw-r--r-- |
|
520
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
1 |
/** |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
2 |
@namespace Holds functionality related to running plugins. |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
3 |
*/ |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
4 |
JSDOC.PluginManager = { |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
5 |
} |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
6 |
|
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
7 |
/** |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
8 |
@param name A unique name that identifies that plugin. |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
9 |
@param handlers A collection of named functions. The names correspond to hooks in the core code. |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
10 |
*/ |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
11 |
JSDOC.PluginManager.registerPlugin = function(/**String*/name, /**Object*/handlers) { |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
12 |
if (!defined(JSDOC.PluginManager.plugins)) |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
13 |
/** The collection of all plugins. Requires a unique name for each. |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
14 |
*/ |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
15 |
JSDOC.PluginManager.plugins = {}; |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
16 |
|
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
17 |
|
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
18 |
JSDOC.PluginManager.plugins[name] = handlers; |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
19 |
} |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
20 |
|
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
21 |
/** |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
22 |
@param hook The name of the hook that is being caught. |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
23 |
@param target Any object. This will be passed as the only argument to the handler whose |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
24 |
name matches the hook name. Handlers cannot return a value, so must modify the target |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
25 |
object to have an effect. |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
26 |
*/ |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
27 |
JSDOC.PluginManager.run = function(/**String*/hook, /**Mixed*/target) { |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
28 |
for (var name in JSDOC.PluginManager.plugins) { |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
29 |
if (defined(JSDOC.PluginManager.plugins[name][hook])) { |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
30 |
JSDOC.PluginManager.plugins[name][hook](target); |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
31 |
} |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
32 |
} |
|
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff
changeset
|
33 |
} |