PageRenderTime 15ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/jsdoc_toolkit-2.3.2/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js

http://jsdoc-toolkit.googlecode.com/
JavaScript | 33 lines | 14 code | 4 blank | 15 comment | 3 complexity | d5ff4cfe6136435f5755e2c9cd9457a1 MD5 | raw file
 1/**
 2	@namespace Holds functionality related to running plugins.
 3*/
 4JSDOC.PluginManager = {
 5}
 6
 7/**
 8	@param name A unique name that identifies that plugin.
 9	@param handlers A collection of named functions. The names correspond to hooks in the core code.
10*/
11JSDOC.PluginManager.registerPlugin = function(/**String*/name, /**Object*/handlers) {
12	if (!defined(JSDOC.PluginManager.plugins))
13		/** The collection of all plugins. Requires a unique name for each.
14		*/
15		JSDOC.PluginManager.plugins = {};
16	
17	
18	JSDOC.PluginManager.plugins[name] = handlers;
19}
20
21/**
22	@param hook The name of the hook that is being caught.
23	@param target Any object. This will be passed as the only argument to the handler whose
24	name matches the hook name. Handlers cannot return a value, so must modify the target
25	object to have an effect.
26*/
27JSDOC.PluginManager.run = function(/**String*/hook, /**Mixed*/target) {
28	for (var name in JSDOC.PluginManager.plugins) {
29		if (defined(JSDOC.PluginManager.plugins[name][hook])) {
30			JSDOC.PluginManager.plugins[name][hook](target);
31		}
32	}
33}