Jquery calling a callback function in a custom function

后端 未结 3 882
一生所求
一生所求 2021-02-08 10:00

I have a custom function and I want to add a callback function to it, i looked through the other questions but I couldn\'t really find the answer for my problem. So basically it

3条回答
  •  旧时难觅i
    2021-02-08 10:39

    function myfunction(callback) {
     // something
    
     callback();
    }
    
    myfunction(callback);
    

    notice I am not invoking the callback but just passing it as a function reference to my function. I then invoke it IN the function at the end or wherever you want to do it.

提交回复
热议问题