Constructor
new Server()
- Source:
Members
(static) uuid
- Description:
- The current session token (UUID). Persisted through AppState so it
survives page navigation/reload according to SystemInfo.stateStore.
- Source:
The current session token (UUID). Persisted through AppState so it
survives page navigation/reload according to SystemInfo.stateStore.
Methods
(async, static) binaryCall(cls, meth, injson) → {Promise.<unknown>}
- Description:
- Perform a binary call. JSON is sent and JSON is returned.
However, a new element will be in the returned json called '_data'.
_data will contain the binary data.
This method is often used to retrieve images.
The back-end service should call
servlet.returnBinary()
- Source:
- See:
-
Parameters:
| Name |
Type |
Default |
Description |
cls |
|
|
|
meth |
|
|
|
injson |
|
null
|
|
Returns:
-
Type
-
Promise.<unknown>
(async, static) call(cls, meth, injson)
- Description:
- Evoke a back-end REST service.
This function is typically called with an await or a then in order to process the result.
- Source:
Parameters:
| Name |
Type |
Default |
Description |
cls |
string
|
|
the web service to be called |
meth |
string
|
|
the web method |
injson |
object
|
null
|
data to be passed to the back-end |
Returns:
data returned from the back-end
(static) callAll()
- Description:
- Used to call a number of simultaneous web services and wait till they're all done
before processing any of their results.
This function takes a variable number of arguments.
The first argument is an array of the Promises from each web service call.
Each remaining argument is a function that gets the result from the positionally corresponding
promise in the first argument. If any are null there is no function executed for that returned promise.
Each function that gets executed gets passed the return value of the associated web service.
You can wait for this function to complete asynchronously by calling it with an await.
The return value is false if all the web services complete and true if there is an error.
- Source:
(static) clearSession()
- Description:
- Drop the persisted session so a fresh login is required. Called by the login
screen, so that returning to it (e.g. via the browser Back button) does not leave
the user silently logged in — a real re-login is required to proceed.
Synchronous and non-navigating (the login screen is already showing). Clearing the
client token is what forces re-authentication; the back-end session is left to
expire on its own (it is unusable once the token is gone).
- Source:
(static) fileUploadSend(cls, meth, fd, injson, waitMsg, successMessage)
- Description:
- Send the file upload to the server.
This method displays a wait message and a final status message.
fd can either be form data or it can be the ID of the file upload control.
- Source:
- See:
-
Parameters:
| Name |
Type |
Default |
Description |
cls |
string
|
|
|
meth |
string
|
|
|
fd |
FormData
|
string
|
|
ctl-id, FormData, FileList, or array of FileList |
injson |
object
|
null
|
|
waitMsg |
string
|
|
optional wait message |
successMessage |
string
|
|
optional success message |
(async, static) logout()
- Description:
- Logs out the current user and reloads the page.
This calls the backend Logout service to properly terminate the session,
then performs a full page reload to clear all context and return to the login screen.
- Source:
(static) setMaxInactivityHours(hours)
- Description:
- Set the maximum number of hours between calls or zero for no max.
If the maximum number of hours is exceeded, the user will be logged out
on their next attempt to make a service call.
- Source:
Parameters:
| Name |
Type |
Description |
hours |
|
|
(static) setMaxInactivityMinutes(minutes)
- Description:
- Set the maximum number of minutes between calls or zero for no max.
If the maximum number of minutes is exceeded, the user will be logged out
on their next attempt to make a service call.
- Source:
Parameters:
| Name |
Type |
Description |
minutes |
|
|
(static) setMaxInactivitySeconds(seconds)
- Description:
- Set the maximum number of seconds between calls or zero for no max.
If the maximum number of seconds is exceeded, the user will be logged out
on their next attempt to make a service call.
- Source:
Parameters:
| Name |
Type |
Description |
seconds |
|
|
(static) setURL(url)
- Description:
- Set the URL of the back-end.
- Source:
Parameters:
| Name |
Type |
Description |
url |
string
|
|
(async, static) verifyServerInstance()
- Description:
- Detect a back-end restart at startup. If a session is persisted but the server's
boot id has changed since that session was established, the back end was rebooted —
drop the stale session so the user is forced to re-login instead of resuming onto a
dead session. Call once at startup, before routing begins.
- Source: