开发者

_addFunctionCall method in Javascript

Is there any method in JS named _addFunctionCall ? I came across following line in a legacy application.

Method defination:

i2b2.ONT.ajax._addFunctionCall( "GetNameInfo",
                                "{{{URL}}}getNameInfo", 
                                i2b2.ONT.cfg.msgs.GetNameInfo,
                                null,
                                i2b2.ONT.cfg.parsers.E开发者_开发知识库xtractConcepts);   

Method call:

var results = i2b2.ONT.ajax.GetNameInfo("ONT:FindBy", searchOptions);   

My another question is GetNameInfo method call contains only two parameters while it seems that method defination contains more than two parameters.So how things work here ?


  1. That appears to be code from the proprietary "i2b2.ONT" library; google for it; https://community.i2b2.org/wiki/display/NCBO/NCBO+Ontology+Tools
  2. The number of arguments passed to a js function does not need to match the number the function was declared with.
    An argument not passed will be undefined within the function (just like any other uninitialized variable) & extra arguments can be read within the function via arguments[ordinal].


_addFunctionCall is not a native JavaScript method.

It appears that the application you are looking at the source code for, has its own function called _addFunctionCall that constructs a function based on the input arguments and adds it to the object.


It's not standard javascript.

you'll have to look for the definition of the i2b2.ONT.ajax object.

There are no method definitions in the code you posted, but two different methods calls : - _addFunctionCall takes 5 parameters (at least) - GetNameInfo takes two.


_addFunctionCall is defined in the i2b2 hive's i2b2_cell_communicator.js file. Check the 1.7 source or whatever source you are using in your hive.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜