Core
Core JavaScript features
Integrate your JavaScript code with the basic functions of your AppMachine app. This page discusses the available functions and possible errors that lie at the basis of each JavaScript block.
Get Block Nameโ
Get the current name of the block.
Errorsโ
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
INVALID_ARGUMENT
The 'caption' property is not defined on the block.
Get Propertyโ
Get a property by name from the current block.
Argumentsโ
propertyName
String
โ
-
Errorsโ
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
INVALID_ARGUMENT
The provided propertyName
is not found.
Get Image Urlโ
Get a public URL of an image, based on the given imageId
.
Image Resizingโ
By default the image URL that will be returned is the URL of the image in full resolution. We recommend using fixed dimensions for the width
and height
options when using high resolution images. This also improves performance and saves bandwidth.
Basic Exampleโ
Multiple Image sizesโ
It is also possible to use multiple image resolution depending on the device resolution or pixel density using image src sets. Read MDN guide for more information.
Resultโ
Argumentsโ
imageId
String
โ
-
dimensions
{ width: Number, height: Number }
-
Errorsโ
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
INVALID_ARGUMENT
imageId
is missing or the width
or height
isn't a number.
Show Loaderโ
Show an overlay with a spinner.
Hide Loaderโ
Hide the loader overlay that was shown by the showLoader
function.
Errorsโ
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
OPERATION_NOT_ALLOWED
There is no active loader.
Generic errorsโ
UNKNOWN_ERROR
Unknown error occurred.
TIMEOUT_EXCEEDED
The app failed to respond within the set timeout.
UNKNOWN_FUNCTION
The function that was called doesn't exist.
VERSION_NOT_SUPPORTED
The function isn't supported in the current version of the app.
Last updated
Was this helpful?