| 
									
										
										
										
											2025-07-16 22:29:28 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-22 18:49:30 +08:00
										 |  |  | const PluginEnvironment = require("./PluginEnvironment"); | 
					
						
							| 
									
										
										
										
											2017-01-03 02:11:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-08 04:27:22 +08:00
										 |  |  | module.exports = function applyPluginWithOptions(Plugin) { | 
					
						
							| 
									
										
										
										
											2024-07-31 09:37:24 +08:00
										 |  |  | 	// eslint-disable-next-line prefer-rest-params
 | 
					
						
							| 
									
										
										
										
											2025-04-22 18:49:30 +08:00
										 |  |  | 	const plugin = new (Function.prototype.bind.apply(Plugin, arguments))(); | 
					
						
							|  |  |  | 	const pluginEnvironment = new PluginEnvironment(); | 
					
						
							| 
									
										
										
										
											2017-01-04 03:08:15 +08:00
										 |  |  | 	plugin.apply(pluginEnvironment.getEnvironmentStub()); | 
					
						
							| 
									
										
										
										
											2017-01-08 10:11:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-22 18:49:30 +08:00
										 |  |  | 	const env = this === global ? {} : this; | 
					
						
							| 
									
										
										
										
											2017-01-08 10:11:53 +08:00
										 |  |  | 	env.plugin = plugin; | 
					
						
							|  |  |  | 	env.pluginEnvironment = pluginEnvironment; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 02:11:33 +08:00
										 |  |  | 	return pluginEnvironment.getEventBindings(); | 
					
						
							|  |  |  | }; |