Skip to main content

Workspace Context

All of the workspaces have the possibility to access the context, where it is possible to find the info of the components, the workspace and perform operations like get, set and subscribe

Can have access in two ways:

  1. Clicking on the button "set default value", and shows the default parameters of the functions, that includes the workspaceContext

  2. If a function already exists and the context parameter isn't declared, it could be added manually.

WorkspaceContext is a function that has three main properties:

  • Set
  • Get
  • Subscribe
  • Definition
  • ComponentDefinition
note

It allows you to set a context variable in a workspace and access that variable in another workspace under the same routing scope.


Set

Used to set the the value in a variable to use posteriorly

ParameterTypeRequiredDescription
nameStringtrueName to reference the valued passed
valueAnytrueAny type of value can be passed
workspaceContext.set("name", value);

img

tip

Variable updateClient set at function onInitialized, to save the component


Get

Used to get the value saved previously

ParameterTypeRequiredDescription
nameStringtrueName of the reference passed previously
workspaceContext.get("name");

img

tip

Getting the value saved at variable updateClient


Subscribe

Subscribe the context's variable you want to listen

ParameterTypeRequiredDescription
nameStringtrueName to reference the passed value
callBackStringtrueA callBack function

 workspaceContext.get('name', callBack function(){});

img img

tip
  • Subscribe the variable updateClient defined at the beggining. In this case the value was used to show a pop-up if the client exists
  • Use the new value to make the necessary changes everytime the variable value is updated.