Resource service marshals content used by a form. Content is sourced either locally (in generated form) or remotely (for design/preview).
Members
-
Resource.browserType
-
Gets the name of the user's browser. The following browsers can be identified: Opera, Firefox, Safari, IE, Edge, Edge-Chromium, Chrome, and Blink.
Examples
Resource.browserType; // => "Firefox"
Resource.browserType; // => "Unknown"
-
Resource.deviceType
-
Get the name of the user's device. The following devices can be identified: iOS, Android, BlackBerry, IEMobile, and Opera.
Examples
Resource.deviceType; // => "iOS"
Resource.deviceType; // => "Unknown"
-
Resource.isMobile
-
Checks if the user's device is a mobile device. It does not provide 100% coverage, but the following devices are supported: iOS, Android, BlackBerry, IEMobile, and Opera Mini.
Examples
Resource.isMobile; // => true
Resource.isMobile; // => false
Methods
-
Resource.fontPath(path)
-
Converts the specified path to a font resource location.
Parameters:
Name Type Description path
string Returns:
- Type
- string
Examples
Resource.fontPath("Roboto.ttf"); // => services/formresources/9935/fonts/Roboto.ttf
Resource.fontPath("Roboto.ttf"); // => ./fonts/Roboto.ttf
-
Resource.get(path)
-
Checks for the resource available locally in the form before fetching via Http.get. To get an application resource, use with its normal path (mainly relevant to form generation process). To get a form resource, convert the relative path with Resource.path method first.
Parameters:
Name Type Description path
Returns:
- Type
- Promise
-
Resource.imagePath(path)
-
Converts the specified path to an image resource location.
Parameters:
Name Type Description path
string Returns:
- Type
- string
Examples
Resource.imagePath("hello-world.png"); // => "services/formresources/6728/images/hello-world.png"
Resource.imagePath("hello-world.png"); // => "./images/hello-world.png"
-
Resource.path(path [, formDesignVersionId])
-
Converts the specified relative path to a form resource path respective of environment.
Parameters:
Name Type Argument Description path
string formDesignVersionId
string <optional>
Can be used to explicitly set the formDesignVersionId. Otherwise the ID of the version in design is used. Returns:
- Type
- string
Examples
Resource.path("hello-world.png"); // => services/formresources/9935/hello-world.png
Resource.path("hello-world.png", "1234"); // => services/formresources/1234/hello-world.png