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