Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to overwrite a run-time function js

i need to overwrite a function that I take from a script, the function start like this:

(function (K) {
//code
})(window);

for a normal function it's easy:

function nameFun = function (params) {
//code
}

so now , how I can overwrite that function ?

Thank you

like image 483
Scutto Avatar asked Mar 05 '26 15:03

Scutto


1 Answers

I don't believe you can - it's an anonymous function that is immediately invoked, so it won't be stored on any object for you to overwrite. Even if it were stored somewhere, as it is invoked immediately you're not going to be able to overwrite the function with your own code before it's execution.

like image 149
Ian Avatar answered Mar 08 '26 05:03

Ian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!