Skip to content

gi-nx


gi-nx / GiraffeState

Properties

PropertyType
attrGiraffeStateAttrMap
listenersRecord<string, any>

Methods

addListener()

ts
addListener(keys: (
  | "project"
  | "selected"
  | "mapView"
  | "mapContent"
  | "mapSelectCoord"
  | "projects"
  | "bakedSections"
  | "projectLayers"
  | "rawSections"
  | "flows"
  | "blocks"
  | "projectOrigin"
  | "projectAppsByAppID"
  | "layerTree"
  | "selectedProjectApp"
  | "mapHoverCoords"
  | "closingSignal"
  | "uiLayout"
  | "contextMenuClick"
  | "views"
  | "mapboxEvent"
  | "workspace"
  | "visibleScenarios")[], listener: (key: 
  | "project"
  | "selected"
  | "mapView"
  | "mapContent"
  | "mapSelectCoord"
  | "projects"
  | "bakedSections"
  | "projectLayers"
  | "rawSections"
  | "flows"
  | "blocks"
  | "projectOrigin"
  | "projectAppsByAppID"
  | "layerTree"
  | "selectedProjectApp"
  | "mapHoverCoords"
  | "closingSignal"
  | "uiLayout"
  | "contextMenuClick"
  | "views"
  | "mapboxEvent"
  | "workspace"
  | "visibleScenarios", event: MessageEvent) => void): string;

Parameters

ParameterType
keys( | "project" | "selected" | "mapView" | "mapContent" | "mapSelectCoord" | "projects" | "bakedSections" | "projectLayers" | "rawSections" | "flows" | "blocks" | "projectOrigin" | "projectAppsByAppID" | "layerTree" | "selectedProjectApp" | "mapHoverCoords" | "closingSignal" | "uiLayout" | "contextMenuClick" | "views" | "mapboxEvent" | "workspace" | "visibleScenarios")[]
listener(key: | "project" | "selected" | "mapView" | "mapContent" | "mapSelectCoord" | "projects" | "bakedSections" | "projectLayers" | "rawSections" | "flows" | "blocks" | "projectOrigin" | "projectAppsByAppID" | "layerTree" | "selectedProjectApp" | "mapHoverCoords" | "closingSignal" | "uiLayout" | "contextMenuClick" | "views" | "mapboxEvent" | "workspace" | "visibleScenarios", event: MessageEvent) => void

Returns

string


get()

ts
get<K>(key: K): GiraffeStateGet[K];

Type Parameters

Type Parameter
K extends | "project" | "selected" | "mapView" | "mapContent" | "mapSelectCoord" | "projects" | "bakedSections" | "projectLayers" | "rawSections" | "flows" | "blocks" | "projectOrigin" | "projectAppsByAppID" | "layerTree" | "selectedProjectApp" | "mapHoverCoords" | "closingSignal" | "uiLayout" | "contextMenuClick" | "views" | "mapboxEvent" | "workspace" | "visibleScenarios"

Parameters

ParameterType
keyK

Returns

GiraffeStateGet[K]

Remarks

The returned snapshot is read-only. Don’t mutate it. Copy before editing: const editable = structuredClone(snap) (deep) or const editable = { ...snap } (shallow).


listen()

ts
listen(): void;

Returns

void


removeAllListeners()

ts
removeAllListeners(): void;

Returns

void


removeListener()

ts
removeListener(listenerKey: any): void;

Parameters

ParameterType
listenerKeyany

Returns

void


set()

ts
set<K>(
   key: K, 
   value: Partial<GiraffeStateSelected & GiraffeStateMapView & GiraffeStateMapContent & GiraffeStateMapSelectCoord & GiraffeStateProjects & GiraffeStateBakedSections & GiraffeStateProjectLayers & GiraffeStateRawSections & GiraffeStateFlows & GiraffeStateBlocks & GiraffeStateProject & GiraffeStateProjectOrigin & GiraffeStateProjectAppsByAppID & GiraffeStateLayerTree & GiraffeStateSelectedProjectApp & GiraffeStateMapHoverCoords & GiraffeStateClosingSignal & GiraffeStateUiLayout & GiraffeStateContextMenuClick & GiraffeStateViews & GiraffeStateMapboxEvent & GiraffeStateWorkspace & GiraffeStateVisibleScenarios>[K], 
   event: MessageEvent): void;

Type Parameters

Type Parameter
K extends | "project" | "selected" | "mapView" | "mapContent" | "mapSelectCoord" | "projects" | "bakedSections" | "projectLayers" | "rawSections" | "flows" | "blocks" | "projectOrigin" | "projectAppsByAppID" | "layerTree" | "selectedProjectApp" | "mapHoverCoords" | "closingSignal" | "uiLayout" | "contextMenuClick" | "views" | "mapboxEvent" | "workspace" | "visibleScenarios"

Parameters

ParameterType
keyK
valuePartial<GiraffeStateSelected & GiraffeStateMapView & GiraffeStateMapContent & GiraffeStateMapSelectCoord & GiraffeStateProjects & GiraffeStateBakedSections & GiraffeStateProjectLayers & GiraffeStateRawSections & GiraffeStateFlows & GiraffeStateBlocks & GiraffeStateProject & GiraffeStateProjectOrigin & GiraffeStateProjectAppsByAppID & GiraffeStateLayerTree & GiraffeStateSelectedProjectApp & GiraffeStateMapHoverCoords & GiraffeStateClosingSignal & GiraffeStateUiLayout & GiraffeStateContextMenuClick & GiraffeStateViews & GiraffeStateMapboxEvent & GiraffeStateWorkspace & GiraffeStateVisibleScenarios>[K]
eventMessageEvent

Returns

void