jeudi 2 mars 2017

jQuery DataTable API structure - confused with javaScript code

I have some task to solve with jquery DataTables we use on our application. I need to add a feature, the DataTables currently seems not have. To build this feature I tried to debug to understand framework structure and often confused, because while call a method it often lends to function with different name and arguments structure. Why this happen? Here sample: Here call to put data in table

enter image description here

Step into in debugger and I get to confusing place:

enter image description here

  1. I get in anonymous function instead of add method called. This could be if add method was assigned with this anonymous method. Right?
  2. Why it takes two arguments? Why data.data argument appears on second place instead of first? I know javaScript allows to use different arguments number in method but what about change argument place?
  3. The anonymous function I'm currently in, returned from outer wrapper function which assigned to methodScoping variable. Why to wrap in this manner and return?

May be here used some design pattern I cannot identify. Please help.

Aucun commentaire:

Enregistrer un commentaire