javascript - How can function references be executed properly (1)? -


win points window. ns temporary namespace post. thought if wanted access settimeout, copy on function reference such:

ns.settimeout = win.settimeout; 

however, execution throw error:

ns_error_xpc_bad_op_on_wn_proto: illegal operation on wrappednative prototype object @ ... 

to fix error, did:

ns.settimeout = function (arg1, arg2) {     return win.settimeout(arg1, arg2); }; 

however, don't know why fixed it. don't know language mechanics causing behavior.

this fixed problem b.c. changing calling object original when call it.

return win.settimeout(arg1, arg2); 

will set context ( or ) window should be. other answers similar in fact change context correct value using bind apply.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -