VisuallyJsService
Provides the BrowserUIModel and the current UI - whether a Surface or Paper. Also provisions the current Diagram, if applicable. This service is provided in root by default but if you have multiple models in your app you can configure it as a provider in multiple components.
To use the service, inject it:
vjs = inject(VisuallyJsService)
To configure some component as a provider for service:
@Component({
selector:"app-component",
provides:[VisuallyJsService]
})
Any components that are descendants of this component will then have access to a separate instance of the service from the one declared in root scope. This is useful if you want to have multiple models in the same page.
Methods
getDiagram()
getDiagram(
cb):void
Retrieves the current diagram. If the diagram is not available, the callback will be stored and executed when the diagram becomes available.
Parameters
cb
(p) => any
A callback function that takes a Diagram object as its parameter.
Returns
void
Deprecated
Use the diagram signal instead
getInspector()
getInspector(
cb):void
Retrieves the inspector instance. If the inspector is already available, the provided callback function is invoked with the inspector as an argument. If the inspector is not yet ready, the callback is stored in a queue to be executed once the inspector becomes available.
Parameters
cb
(s) => any
A callback function that receives the inspector instance as an argument when it becomes available.
Returns
void
Deprecated
Use the inspector signal instead.
getModel()
getModel(
cb):void
Retrieves the model and executes the provided callback function with it. If the model is already available, the callback is executed immediately. Otherwise, the callback is stored to be executed when the model becomes available.
Parameters
cb
(p) => any
The callback function to execute with the model.
Returns
void
Deprecated
Use the model signal instead
getPaper()
getPaper(
cb):void
Retrieves the paper object and executes the provided callback function with the paper as an argument. If the paper is not yet available, the callback is stored for execution once the paper becomes available.
Parameters
cb
(p) => any
A callback function that is called with the retrieved paper object as an argument.
Returns
void
Deprecated
Use the paper signal instead.
getSurface()
getSurface(
cb):void
Retrieves the surface and executes the provided callback function with the surface as its argument. If the surface is not available, the callback is stored and will be invoked once the surface is ready.
Parameters
cb
(s) => any
A callback function that takes a Surface object as its parameter.
Returns
void
Deprecated
Use the surface signal instead.
getUI()
getUI(
cb):void
Retrieves the UI element and provides it to the callback function once available. If the UI element already exists, it is immediately passed to the callback. Otherwise, the callback is stored to be executed when the UI becomes available.
Parameters
cb
(b) => any
A callback function that receives the UI element b of type BrowserUI as its argument.
Returns
void
Deprecated
Use the ui signal instead