Comment on page
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 the current name of the block.
import { getBlockName } from '@myjsblock/sdk'
const myBlockName = await getBlockName();
// or
getBlockName().then(data => {
console.log(data);
});
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
Error Code | Description |
---|---|
INVALID_ARGUMENT | The 'caption' property is not defined on the block. |
Get a property by name from the current block.
import { getProperty } from '@myjsblock/sdk'
const myProperty = await getProperty('myProperty');
// or
getProperty('myProperty').then(data => {
console.log(data);
});
Name | Type | Required | Default |
---|---|---|---|
propertyName | String | ✅ | - |