-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
call
Function.prototype.call2 = function(context: any, ...args: any[]) {
const ctx = context || window
ctx.fn = this
const res = ctx.fn(...args)
Reflect.deleteProperty(ctx, 'fn')
return res
}apply
Function.prototype.apply2 = function(context: any, args: any[] = []) {
const ctx = context || window
ctx.fn = this
const res = ctx.fn(...args)
Reflect.deleteProperty(ctx, 'fn')
return res
}bind
Function.prototype.bind2 = function(context: any, ...args1: any[]) {
const ctx = context || window
const fn = this
return function F(...args2: any[]) {
return fn.apply(this instanceof F ? this : ctx, [...args1, ...args2])
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels