Page tree
Skip to end of metadata
Go to start of metadata

Smartface provides native app development by using JavaScript language. It has predefined JavaScript files for App (All generic files), i18n ( for localization support) and Page (One file for each Page).

Load & Include

With the new "Load & Include" features, it's possible to work with other JavaScript files, such as third party JavaScript code libraries. Those two run-time functions allow the developer to work with both local (bundled within the app) JavaScript files and remote (over http) JavaScript files.

There is a small difference between "load and include" methods:

load method:

Loads target file only once, regardless that file is called many times with the load method.

include method:

Includes target file as many times as it has been called with the include method.

The main object is that, these methods execute codes at the line where those two methods are called. Hence, please be careful about loaded and included files are executed at the same scope of the function of where the load or include functions are executed; this might affect the declaration of variables.

Check the example below:

 // local file
load('fileName.js');
include('fileName.js');
 // remote file
load('http://example.com/fileName.js');
include('http://example.com/fileName.js');

Adding Local Files to Project

All JavaScript files of the Smartface projects are located under "/scripts" folder. The local JavaScript files should be located in there.

AutoComplete Features

Script Editor automatically fetches and lists these functions, variables and objects which are either in the remote JavaScript files or local JavaScript files. With the autocomplete feature, you can easily write your codes with the third party external JavaScript files.