Methods
(static) apps() → {Array}
Returns an array with app launchers. The data returned is an internal data structure and should not be modified.
- Returns:
- {Array} the loaded app launchers (read-only)
- Source:
- RapidContext_App.js, line 119
(static) callApp(app, method, argsopt) → {Promise}
Performs an asynchronous call to a method in an app. If only the class name or launcher is specified, the most recently created instance will be used. If no instance is running, one will be started. Also, before calling the app method, the app UI will be focused.
- Parameters:
-
Name Type Attributes Description app
{string|Object} the app id, instance, class name or launcher method
{string} the app method name args
{Mixed} <optional>
additional parameters sent to method - Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve with the result of the call on success - Source:
- RapidContext_App.js, line 380
(static) callProc(name, argsopt) → {Promise}
Performs an asynchronous procedure call.
- Parameters:
-
Name Type Attributes Description name
{string} the procedure name args
{Array} <optional>
the array of arguments, or null
- Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve with the response data on success - Source:
- RapidContext_App.js, line 430
(static) downloadFile(url, dataopt)
Downloads a file to the user desktop. This works by creating a new
window or an inner frame which downloads the file from the server.
Due to Content-Disposition
headers being set on the server, the
web browser will popup a dialog for the user to save the file.
This function can also be used for saving a file that doesn't
exist by first posting the file (text) content to the server.
- Parameters:
-
Name Type Attributes Description url
{string} the URL or filename to download data
{string} <optional>
the optional file data (if not available on the server-side) - Source:
- RapidContext_App.js, line 715
(static) findApp(app) → {Object}
Finds the app launcher from an app instance, class name or launcher. In the last case, the matching cached launcher will be returned.
- Parameters:
-
Name Type Description app
{string|Object} the app id, instance, class name or launcher - Returns:
-
{Object}
the read-only app launcher, or
null
if not found - Source:
- RapidContext_App.js, line 148
(static) init(appopt) → {Promise}
Initializes the platform, API:s and RapidContext UI. If an app identifier is provided, the default platform UI will not be created. Instead the app will be launched with the root document as its UI container.
- Parameters:
-
Name Type Attributes Description app
{string|Object} <optional>
the app id or class name to start - Returns:
- {Promise} a promise that will resolve when initialization has either completed or failed
- Source:
- RapidContext_App.js, line 43
(static) loadJSON(url, paramsopt, optionsopt) → {Promise}
Performs an asynchronous HTTP request and parses the JSON response. The
request parameters are automatically encoded to query string or JSON format,
depending on the Content-Type
header. The parameters will be sent either
in the URL or as the request payload (depending on the HTTP method
).
- Parameters:
-
Name Type Attributes Description url
{string} the URL to request params
{Object} <optional>
the request parameters, or null
options
{Object} <optional>
the request options, or null
- Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve with the parsed response JSON on success - Source:
- RapidContext_App.js, line 562
(static) loadScript(url) → {Promise}
Loads a JavaScript to the the current page. The script is loaded by
inserting a <script>
tag in the document <head>
. Function definitions
and values must therefore be stored to global variables by the script to
become accessible after loading. If the script is already loaded, the
promise will resolve immediately.
- Parameters:
-
Name Type Description url
{string} the URL to the script - Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve when the script has loaded - See:
- Use dynamic `import()` instead, if supported by the environment.
- Source:
- RapidContext_App.js, line 671
(static) loadStyles(url) → {Promise}
Loads a CSS stylesheet to the the current page asynchronously. The
stylesheet is loaded by inserting a <link>
tag in the document head
.
If the stylesheet is already loaded, the promise will resolve immediately.
- Parameters:
-
Name Type Description url
{string} the URL to the stylesheet - Returns:
-
{Promise}
a
RapidContext.Async
promise that will callback when the stylesheet has been loaded - Source:
- RapidContext_App.js, line 692
(static) loadText(url, paramsopt, optionsopt) → {Promise}
Performs an asynchronous HTTP request for a text document. The request
parameters are automatically encoded to query string or JSON format,
depending on the Content-Type
header. The parameters will be sent either
in the URL or as the request payload (depending on the HTTP method
).
- Parameters:
-
Name Type Attributes Description url
{string} the URL to request params
{Object} <optional>
the request parameters, or null
options
{Object} <optional>
the request options, or null
- Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve with the response text on success - Source:
- RapidContext_App.js, line 585
(static) loadXHR(url, paramsopt, optionsopt) → {Promise}
Performs an asynchronous HTTP request. The request parameters are
automatically encoded to query string or JSON format, depending on the
Content-Type
header. The parameters will be sent either in the URL or as
the request payload (depending on the HTTP method
).
- Parameters:
-
Name Type Attributes Description url
{string} the URL to request params
{Object} <optional>
the request parameters, or null
options
{Object} <optional>
the request options, or null
- Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve with the XMLHttpRequest instance on success - Source:
- RapidContext_App.js, line 631
(static) loadXML(url, paramsopt, optionsopt) → {Promise}
Performs an asynchronous HTTP request for an XML document. The request
parameters are automatically encoded to query string or JSON format,
depending on the Content-Type
header. The parameters will be sent either
in the URL or as the request payload (depending on the HTTP method
).
- Parameters:
-
Name Type Attributes Description url
{string} the URL to request params
{Object} <optional>
the request parameters, or null
options
{Object} <optional>
the request options, or null
- Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve with the parsed response XML document on success - Source:
- RapidContext_App.js, line 608
(static) login(login, password, tokenopt) → {Promise}
Performs an asynchronous login. If the current session is already bound to a user, that session will be terminated and a new one will be created. If an authentication token is specified, the login and password fields are not used (can be null).
- Parameters:
-
Name Type Attributes Description login
{string} the user login name or email address password
{string} the password to authenticate the user token
{string} <optional>
the authentication token to identify user/password - Returns:
-
{Promise}
a
RapidContext.Async
promise that resolves when the authentication has either succeeded or failed - Source:
- RapidContext_App.js, line 480
(static) logout(reloadopt) → {Promise}
Performs an asyncronous logout. This function terminates the current
session and either reloads the browser window or returns a deferred object
that will produce either a callback
or an errback
response.
- Parameters:
-
Name Type Attributes Default Description reload
{boolean} <optional>
true the reload browser flag - Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve when user is logged out - Source:
- RapidContext_App.js, line 538
(static) startApp(app, containeropt) → {Promise}
Creates and starts an app instance. Normally apps are started in the default app tab container or in a provided widget DOM node. By specifying a newly created window object as the parent container, apps can also be launched into separate windows.
Note that when a new window is used, the returned deferred will callback
immediately with a null
app instance (normal app communication is not
possible cross-window).
- Parameters:
-
Name Type Attributes Description app
{string|Object} the app id, class name or launcher container
{Widget/Window} <optional>
the app container widget or window, defaults to create a new pane in the app tab container - Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve when the app has launched - Example:
-
// Starts the help app in a new tab RapidContext.App.startApp('help'); // Starts the help app in a new window RapidContext.App.startApp('help', window.open());
- Source:
- RapidContext_App.js, line 187
(static) status() → {Object}
Returns an object with status information about the platform and currently loaded environment. The object returned is a copy of the internal data structure and can be modified without affecting the real data.
- Returns:
- {Object} the status data object
- Source:
- RapidContext_App.js, line 98
(static) stopApp(app) → {Promise}
Stops an app instance. If only the class name or launcher is specified, the most recently created instance will be stopped.
- Parameters:
-
Name Type Description app
{string|Object} the app id, instance, class name or launcher - Returns:
-
{Promise}
a
RapidContext.Async
promise that will resolve when the app has been stopped - Source:
- RapidContext_App.js, line 337
(static) uploadFile(id, file, onProgressopt)
Uploads a file to the server. The upload is handled by an asynchronous HTTP request.
- Parameters:
-
Name Type Attributes Description id
{string} the upload identifier to use file
{File} the file object to upload onProgress
{function} <optional>
the progress event handler - Source:
- RapidContext_App.js, line 751
(static) user() → {Object}
Returns an object with information about the user. The object returned is a copy of the internal data structure and can be modified without affecting the real data.
- Returns:
- {Object} the user data object
- Source:
- RapidContext_App.js, line 109