Javascript function hooks

后端 未结 7 999
孤街浪徒
孤街浪徒 2020-12-24 15:17

EDIT: OK, I believe the following solutions are valid:

  1. Use the jQuery AOP plugin. It basically wraps the old function together with the hook into a function

7条回答
  •  Happy的楠姐
    2020-12-24 15:52

    Very simple answer:

    function someFunction() { alert("Bar!") }
    var placeholder=someFunction;
    someFunction=function() {
      alert("Foo?");
      placeholder();
    }
    

提交回复
热议问题