Skip to content

Constant Types

Module Types

MODULE_TYPE is a built-in constant object used to represent different node types. Each type represents a specific component or node with a distinct role in the project structure.

Available Types:

  • MODULE_TYPE.ROOT: Root node, representing the top-level node of the project.
  • MODULE_TYPE.SCENE_PAGE: Scene page node, representing the scene content of a page.
  • MODULE_TYPE.MODAL_PAGE: Modal page node, representing a modal that pops up on the current page.
  • MODULE_TYPE.DRAWER_PAGE: Drawer page node, representing a drawer that slides in from the side of the page.
  • MODULE_TYPE.COMPONENT: Component type node, representing a specific reusable component.
  • MODULE_TYPE.COMPONENT_GROUP: Component group type node, representing a combination of multiple components.
  • MODULE_TYPE.BLOCK: Block node, representing a placeholder element on the page.
  • MODULE_TYPE.EVENT: Event type node, used to handle specific event responses.

Example

js
const nodeType = MODULE_TYPE.SCENE_PAGE;
if (nodeType === MODULE_TYPE.ROOT) {
    // Perform root node related logic
}

Resource Types

RESOURCE_TYPE is a built-in constant object used to identify different resource types within the class. Resource types help the system distinguish and manage different resources.

Available Types:

  • RESOURCE_TYPE.SCENE_PROPS: Scene properties resource type, representing the configuration or properties of a scene.
  • RESOURCE_TYPE.BLOCKS: Module type resource, representing block elements or modules within a page.

Example

js
const resourceType = RESOURCE_TYPE.SCENE_PROPS;
if (resourceType === RESOURCE_TYPE.BLOCKS) {
    // Perform logic related to module resources
}

Drag-and-Drop Types

DND_ITEM_TYPE is a built-in constant object used to identify different types of drag-and-drop items. This type can be used to differentiate between different drag operations, such as scene items or module items.

Available Types:

  • DND_ITEM_TYPE.SCENE_ITEM: Scene item, representing an item being dragged from the scene.
  • DND_ITEM_TYPE.MODULE_ITEM: Module item, representing an item being dragged from a module.

Example

js
const dragItemType = DND_ITEM_TYPE.SCENE_ITEM;
if (dragItemType === DND_ITEM_TYPE.MODULE_ITEM) {
    // Perform drag operation related to module items
}

Lifecycle Types

LIFECYCLE_TYPE is a built-in constant object used to represent different lifecycle stages or event types. These lifecycle types help the system perform specific actions at different stages.

Available Types:

  • LIFECYCLE_TYPE.BEFORE_TRANSFORM_DATA: Before data transformation stage, usually used to handle and modify data before processing.
  • LIFECYCLE_TYPE.AFTER_TRANSFORM_DATA: After data transformation stage, used for additional operations after data has been processed.
  • LIFECYCLE_TYPE.GET_JSON_DATA: Retrieve JSON data stage, typically used to extract or handle JSON data.
  • LIFECYCLE_TYPE.RENDERER_DEVELOPMENT_CONTENT: Render content in development environment, representing rendering actions in the development environment.
  • LIFECYCLE_TYPE.RENDERER_PRODUCTION_CONTENT: Render content in production environment, representing rendering actions in the production environment.

Example

js
const lifecycleStage = LIFECYCLE_TYPE.GET_JSON_DATA;
if (lifecycleStage === LIFECYCLE_TYPE.BEFORE_TRANSFORM_DATA) {
    // Perform operations before data transformation
}