The AttachmentAPI provides basic functionalities to define additional data optionally attached to a node.
This data can be of any type defined in AttachmentType and is stored in the form of a URI.
The AttachmentAPI provides methods to fetch, set and remove the data.
Quick Start
Example: Create a new attachment with text data.
constcontext = webvis.getContext();// Create a new attachmentconstattachmentId = context.createAttachment(webvis.AttachmentType.TEXT);// Set the attachment datacontext.setAttachmentData(attachmentId, "hello world");// Fetch the attachment dataawaitcontext.fetchAttachmentData(attachmentId); // returns "hello world"
Adding Attachments to nodes
Attachments can be added to nodes using the setProperty method.
Example: attaching an attachment to a node.
constcontext = webvis.getContext();// Create a new attachment and set dataconstattachmentId = context.createAttachment(webvis.AttachmentType.TEXT);context.setAttachmentData(attachmentId, "hello world");// Attach the attachment to a nodecontext.setProperty(nodeId, webvis.Property.ATTACHMENT, attachmentId);// Fetch the attachment dataawaitcontext.getProperty(nodeId, webvis.Property.ATTACHMENT); // returns "hello world"
Events
The following events are associated with the AttachmentAPI:
Performs a safe remove which interrupt the removal process if the attachment is part of one or more snapshots. If no safe remove, a snapshot could link to missing data. Default: false.
webvis: The AttachmentAPI
Overview
The AttachmentAPI provides basic functionalities to define additional data optionally attached to a node. This data can be of any type defined in AttachmentType and is stored in the form of a URI. The AttachmentAPI provides methods to fetch, set and remove the data.
Quick Start
Example: Create a new attachment with text data.
Adding Attachments to nodes
Attachments can be added to nodes using the setProperty method.
Example: attaching an attachment to a node.
Events
The following events are associated with the AttachmentAPI: