| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2017-01-02 13:54:23 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class AbstractPlugin { | 
					
						
							|  |  |  | 	static create(plugins) { | 
					
						
							|  |  |  | 		return class Plugin extends AbstractPlugin { | 
					
						
							|  |  |  | 			constructor() { | 
					
						
							|  |  |  | 				super(plugins); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-02 13:54:23 +08:00
										 |  |  | 	constructor(plugins) { | 
					
						
							|  |  |  | 		this._plugins = plugins || {}; | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-02 13:54:23 +08:00
										 |  |  | 	apply(object) { | 
					
						
							|  |  |  | 		for(const name in this._plugins) { | 
					
						
							|  |  |  | 			object.plugin(name, this._plugins[name]); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-01-02 13:54:23 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = AbstractPlugin; |