Javascript, get the name of a bound function -


i've created function , bound arguments below.

function myfunc(){}  let boundfunc = myfunc.bind(argument); 

but pass bound function argument function, need name. following:

function dothething(callable){     console.log(callable.name + " did thing"); }  dothething(boundfunc); 

prints out bound did thing rather myfunc did thing. there way name of bound function?


callable.caller results in uncaught typeerror: 'caller' , 'arguments' restricted function properties , cannot accessed in context. , not browser standard.

google chrome v 51.0.2704.103 gives different result:

function myfunc(){}    let boundfunc = myfunc.bind(null);    function dothething(callable){    console.log(callable.name + " did thing");  }    dothething(boundfunc);

it prints bound myfunc did thing, original name callable.name.substring(6)


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -