adding callback to function - always

后端 未结 3 2208
忘了有多久
忘了有多久 2021-02-09 06:53

I found myself using a weird way to add callback functions to my functions and I was wondering if there is a more generic way to add callbacks to functions, best case I would ha

3条回答
  •  情深已故
    2021-02-09 07:36

    Not sure what you are trying to do here, but a way to add a callback that seems more straight forward:

    function( obj, callback ) {
       if(callback) {
          callback();
       }
    }
    

提交回复
热议问题