BlocksModule Overview
BlocksModule Overview
BlocksModule Overview


The BlocksModule class provides methods for interacting with the Blocks in your effect.


(get) assets: BlockAssets
(set) (Not Available)

Get an object that allows access to the Block Assets.
(get) inputs: BlockInstanceInputs
(set) (Not Available)

Get an object encapsulating all inputs for this Block.
(get) modulesConfigExtras: {[key: string]: any} | null
(set) (Not Available)

Get an object encapsulating all extras for this Block. Returns null if no extras was configured during block initialization.
(get) outputs: BlockInstanceOutputs
(set) (Not Available)

Gets an object encapsulating all outputs for this Block.


download(blockAssetOrName: string | BlockAsset): Promise<string>

Downloads the given Block Asset, or the Block with the given name, and returns a Promise that
is resolved with the Block's name (if the download succeeds), or fails with an error (if it does not).
For Blocks that are not downloadable, this becomes a no-op.
For Blocks that were already downloaded and are already available, this becomes a no-op.

Downloading doesn't instantiate the Block or add it to the scene, or make its inputs/outputs available,
but makes sure that all the assets that are required are downloaded and are readily available.
instantiate(blockAssetOrName: string | BlockAsset, initialState: {[key: string]: any}, modulesConfig?: BlockModulesConfig): Promise<BlockSceneRoot>

Instantiate a Block asynchronously, given a Block Asset or its name.
When instantiating blocks, keep the following in mind:
- Creation of Blocks is bound to the same set of guidelines as Scene.create().
- New blocks always get assigned a globally unique identifier.`
- initialState is optional, but encouraged to be used.
- initialState can contain any key: value pair for any settable property of a Block class (e.g. hidden).
- name in initialState is being used, unless it's not provided - then "dynamicBlock" is used.
- modulesConfig is optional. In contrast to initialState, which defines properties for the BlockSceneRoot object, modulesConfig is used to configure any information needed for JavaScript modules and other such functionality inside the Block itself.
- See BlockModulesConfig for information on which fields are accepted here.
- Block's inputs and outputs are not accessible until SceneObjectBase.addChild() call finishes

Note: This API requires "Scripting Dynamic Instantiation" capability to be enabled.


BlockAssetThis class represents a single Block Asset.
BlockAssetsThis class allows access to the Block Assets.
BlockInstanceInputsRepresents an object encapsulating all inputs for a Block.
BlockInstanceOutputsRepresents an object encapsulating all outputs for a Block.
BlockModulesConfigThe BlockModulesConfig are key-value pairs used to define the behavior of certain features and JavaScript modules inside a dynamically instantiated Block.
All properties below are optional, and you may specify them to determine how these JS modules and features are going to behave on dynamically instantiated Blocks.

Was this article helpful?