Inject javascript into a javascript function

前端 未结 7 1790
别跟我提以往
别跟我提以往 2021-02-04 13:25

I\'ve got a weird question in that I need to inject some javascript into another javascript function. I am using a framework which is locked so I can not change the existing fun

7条回答
  •  离开以前
    2021-02-04 13:50

    I can not change the doSomething function... Instead I need to somehow inject a few lines of code into the end of the doSomething code

    Injecting a few lines into the end of the doSomething code sounds like changing the doSomething function, to me. I think, unfortunately, that you’re screwed.

    (I’m a bit hazy on all this, but I think functions are how people who worry about such things implement information hiding in JavaScript, precisely because you can’t access their scope from outside them.)

提交回复
热议问题