The base URI of the server-side API
The host name of the server-side
The base REST URI of the server-side API
Placeholder of the current system locale dictionary, the system uses this dictionary to translate all translatable texts to the current locale language
Placeholder for all global search handles registered to the system. These callbacks will be called when user performs the search operation in the spotlight UI.
Applications can define their own search handle to provide the spotlight UI with additional search results
Placeholder to store all loaded shared libraries. Once a shared library is firstly loaded, its identity will be stored in this variable. Based on this information, in the next use of the library, the system knows that the library is already loaded and ready to use.
A shared library can be a javascript or a CSS file.
An apigateway allows client side to execute a custom server-side script and get back the result. This gateway is particularly useful in case of performing a task that is not provided by the core API
execution indication, provided only when ws is false
otherwise, d
should be written directly to the websocket stream as JSON object.
Two possible formats of d
:
execute an server-side script file:
{
path: [VFS path],
parameters: [parameters of the server-side script]
}
or, execute directly a snippet of server-side script:
{ code: [server-side script code snippet as string] }
flag indicate whether to use websocket for the connection to the gateway API. In case of streaming data, the websocket is preferred
a promise on the result object (any)
REST-based API.
Perform a GET request and read back the data in
ArrayBuffer
(binary) format. This is useful for
binary data reading
resource URI
a promise on the returned binary data
Perform an REST GET request
the URI of the request
a Promise on the requested data
Get the clipboard data
Promise on the clipboard data
Helper function to verify whether a shared library is loaded and ready to use
path to the library
Helper function to trigger the global loaded
event: This event should be triggered in the
end of a heavy task that has previously triggered
the loading
event
the message id of the corresponding loading
event
the message string
message status (OK
of FAIL
)
Helper function to trigger the global loading
event. This event should be triggered in the
beginning of a heavy task
message id, see mid
message string
Re-export the system announcement getMID function to the core API
Register a search handle to the global searchHandle
handle name string
search handle
REST-based API.
Perform a POST request to the server. Data exchanged
is in application/json
the server URI
data object that will be converted to JSON
a promise on the result data
Synchronously load a list of shared libraries
list of shared libraries
Load a shared library if not ready
VFS path to the library
force reload library
a promise on the result data
REST-based API
Get the content of a global asset resource stored
in os://resources/
relative path to the resource
promise on the returned content
REST-based API.
Download a file
file name
file content
REST-based API
Perform a GET operation and executed the returned content as javascript
URI resource
promise on the executed content
Perform the global search operation when user enter text in spotlight.
This function will call all the search handles stored in searchHandle and build the search result based on output of these handle
text to search
Set value to the system clipboard
clipboard value
Set the current system locale: This function will
find and load the locale dictionary definition file in the
system asset resource, then trigger the global event
systemlocalechange
to translated all translatable text
to the target language
locale name, e.g. en_GB
Save the current user setting
promise on a RequestResult
A switcher object is a special object in which each object's property is a boolean option. All object's properties are mutual exclusive. It means that when a property is set to true, all other properties will be reset to false.
Example:
let view = API.switcher("tree", "list", "icon")
view.tree = true // view.list = false and view.icon = false
view.list = true // view.tree = false and view.icon = false
Return an error Object: AntOS use this function to collect information (stack trace) from user reported error.
error string
REST-based API.
Send file to server
resource URI
VFS path of the destination file
The namespace API is dedicated to the definition of the core system APIs used by AntOS and its applications. The following core APIs are defined:
These APIs are considered as middle-ware that abstracts the client-server communication and provide the application layer with a standardized APIs for file/database access, system events handling (announcement), automatic dependencies resolving, etc.