The BlocksModule
class provides methods for interacting with the Blocks in your effect.
Property | Description |
---|---|
assets | (get) assets: BlockAssets Get an object that allows access to the Block Assets. |
inputs | (get) inputs: BlockInstanceInputs Get an object encapsulating all inputs for this Block. |
outputs | (get) outputs: BlockInstanceOutputs Gets an object encapsulating all outputs for this Block. |
Method | Description |
---|---|
download | 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 | 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 finishesNote: This API requires "Scripting Dynamic Instantiation" capability to be enabled. |
Class | Description |
---|---|
BlockAsset | This class represents a single Block Asset. |
BlockAssets | This class allows access to the Block Assets. |
BlockInstanceInputs | Represents an object encapsulating all inputs for a Block. |
BlockInstanceOutputs | Represents an object encapsulating all outputs for a Block. |
BlockModulesConfig | The 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. |