Page 1 of 1

Confirmation requested: Appery will use last instance of two functions with same name in same library.

Posted: Thu May 21, 2015 7:17 pm
by RobertJay

Confirmation requested: Appery will use last instance of two functions with same name in same library.

Posted: Thu May 21, 2015 8:16 pm
by Serhii Kulibaba

Hello,

Could you clarify your question?

You can get array of components with the same name via jQuery:

var arr = $("[name=comnponentName]");


Confirmation requested: Appery will use last instance of two functions with same name in same library.

Posted: Thu May 21, 2015 8:34 pm
by RobertJay

Sorry for not being clear. Suppose in my JS file I have a function on line 200. Then, on line 400, I have a function with the same name but slightly different content. When my app calls that function, which one will be invoked? According to that stackoverflow post, it will be the one on line 400. Can I assume that's always the case with Appery. Thanks.


Confirmation requested: Appery will use last instance of two functions with same name in same library.

Posted: Mon May 25, 2015 11:43 am
by Serhii Kulibaba

The best way is don't use functions with the same name.


Confirmation requested: Appery will use last instance of two functions with same name in same library.

Posted: Mon May 25, 2015 1:01 pm
by RobertJay

Sergiy - it's frankly annoying that in four days your response is to a non-asked question (I already know it's best not to duplicate names). But responding to your non-answer let me say this: what would really best is for the Appery editor to alert the user to duplicate function names at least within the same file; and if that's not possible, to at least allow searches and finds to extend beyond the immediate editor view which it does not do (at least in Firefox).

FYI, my question came about because of a whole bunch of same-named (but potentially slightly different) functions existing in the same file - probably from some inadvertent copy-and-pastes on my part. Since the app is working fine, I wanted to delete superfluous functions and thought knowing whether they were the first or last-occurring would have hastened the process.

In any case, I'll proceed on my own.