| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | function AbstractPlugin(plugins) { | 
					
						
							|  |  |  | 	this._plugins = plugins || {}; | 
					
						
							| 
									
										
										
										
											2015-04-24 05:55:50 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | module.exports = AbstractPlugin; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | AbstractPlugin.create = function(plugins) { | 
					
						
							|  |  |  | 	function Plugin() { | 
					
						
							| 
									
										
										
										
											2015-04-24 05:55:50 +08:00
										 |  |  | 		AbstractPlugin.call(this, plugins); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	Plugin.prototype = Object.create(AbstractPlugin.prototype); | 
					
						
							|  |  |  | 	return Plugin; | 
					
						
							| 
									
										
										
										
											2014-06-25 00:53:32 +08:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | AbstractPlugin.prototype.apply = function(object) { | 
					
						
							| 
									
										
										
										
											2015-07-16 06:19:23 +08:00
										 |  |  | 	for(var name in this._plugins) { | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 		object.plugin(name, this._plugins[name]); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; |