Inject javascript into a javascript function

前端 未结 7 1873
别跟我提以往
别跟我提以往 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

    Alias it.

    var oldDoSomething = doSomething;
    doSomething = function() {
      // Do what you need to do.
      return oldDoSomething.apply(oldDoSomething, arguments);
    }
    

提交回复
热议问题