Source language: Translate to:

Question About Global Variables

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Question About Global Variables

Postby Neosoft Support » Wed Mar 11, 2015 8:35 am

NeoBook includes a number of predefined Global Variables which include things like the current date/time, window size, etc. NeoAppBuilder will have something similar, but I wanted to get your input on two things:

1. Since the term "Global Variable" has a somewhat different meaning in JavaScript, should we call our global variables something else to avoid confusion? For example:

System Variables
Static Variables
Predefined Variables
Special Variables
or ???

2. To avoid conflicts with user-defined variables, should we add some type of prefix to global variables. For example, instead of [Time] we would use:

[#Time]

It doesn't matter that "#" is not a valid character for JavaScript variable names, since global variable names are simply place holders and are replaced by NeoAppBuilder's compiler. Using # as a prefix would work well since we use that for the special Unicode/ASCII code variables like [#13]. This makes sense for consistency, but is a departure from NeoBook methods.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Question About Global Variables

Postby Gaev » Wed Mar 11, 2015 10:02 am

Dave:

Thanks for asking ... here is MHO ...

1) In declining order of preference ...

Predefined Variables
Special Variables
System Variables

2) As an alternative ... assuming NeoSoftAppBuilder can handle the syntax ... how about something like ...

[NAB.Time]
or
[NAB#Time]
or
[#NAB.Time]

This is predicated by the idea that NeoSoftAppBuilder could also provide corresponding (Global) Javascript variables for the developer's convenience ... in which case, taking advantage of Javascript's Object (JSON) facilities, the variables could be contained (as key/value pairs) in a single object ... so they could be accessed like ...

NAB.Time
NAB.ScreenWidth
etc. etc.

So, as a developer, all your "predefined variables" are in similarly named "objects" ... and accessible from NeoSoft or Javascript commands.

</MHO>
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Question About Global Variables

Postby luishp » Wed Mar 11, 2015 1:05 pm

I do agree with Gaev.
:-)
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 359
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Re: Question About Global Variables

Postby Neosoft Support » Fri Mar 13, 2015 10:03 am

This is predicated by the idea that NeoSoftAppBuilder could also provide corresponding (Global) Javascript variables for the developer's convenience ...


That's a really interesting idea. I'll look into it further.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron