Socket
Book a DemoInstallSign in
Socket

@vcmap/event-control

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vcmap/event-control

> Part of the [VC Map Project](https://github.com/virtualcitySYSTEMS/map-ui)

latest
npmnpm
Version
1.0.1
Version published
Maintainers
2
Created
Source

@vcmap/event-control

Part of the VC Map Project

The Event Control plugin is intended to perform actions in reaction to events. In particular, it allows callbacks to be executed in reaction to various events.

The trigger events that can be used are as follows:

  • Layer state change
  • Map state change
  • Module added/removed
  • Planning project state change
  • Window state change

Configuration

Plugin configuration is simple: the actions property is an array of actions, defined as follows:

PropertyTypeDescriptionPossible values
typeStringThe type of event to react to.layer, map, module, planning, window
targetNameStringThe name of the target (layer, planning id, ...) to react to.any
onActivateArrayOptional. Callback options to be executed on target's activation.
onDeactivateArrayOptional. Callback options to be executed on target's deactivation.

For more information about callbacks, see the Callback documentation.

Configuration examples

  • I want to toggle the state of layer2 at the same time as that of layer1:
"actions": [
    {
      "type": "layer",
      "targetName": "layer1",
      "onActivate": [
        {
          "type": "ActivateLayersCallback",
          "layerNames": ["layer2"]
        }
      ],
      "onDeactivate": [
        {
          "type": "DeactivateLayersCallback",
          "layerNames": ["layer2"]
        }
      ]
    }
]
  • I want the layer planningLayer to be activated when enabling the Planning project with id planningId:
"actions": [
    {
      "type": "planning",
      "targetName": "planningId",
      "onActivate": [
        {
          "type": "ActivateLayersCallback",
          "layerNames": ["planningLayer"]
        },
      ]
    }
]
  • I want the Legend window to open when enabling the layer layerWithLegend:
"actions": [
    {
      "type": "layer",
      "targetName": "layerWithLegend",
      "onActivate": [
        {
          "type": "ToggleNavbarButtonCallback",
          "buttonId": "legendId",
          "activeState":true
        }
      ]
    }
]
  • I want a module to be enabled only in 3D:
"actions": [
    {
      "type": "map",
      "targetName": "cesiumMap",
      "onActivate": [
        {
          "type": "AddModuleCallback",
          "module": "config/3Dconfig.json"
        }
      ],
      "onDeactivate": [
        {
          "type": "RemoveModuleCallback",
          "moduleId": "config/3Dconfig.json"
        }
      ]
    }
]
  • I want the map to start rotating when opening MyOwnPlugin:
"actions": [
    {
      "type": "window",
      "targetName": "myOwnPluginWindowId",
      "onActivate": [
        {
          "type":"StartRotationCallback"
        }
      ]
    }
]

Keywords

vcmap

FAQs

Package last updated on 12 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts