onDrawingNewRevision
Drawing revision creation handler
This example demonstrates how the onDrawingNewRevision callback
sends a request to the host application to store a new drawing revision, its associated drawing storage, and its updated layouts. The callback provides the host application
with the new DIQ_DrawingRevision record, the new DIQ_Storage object
containing the drawing file, the updated layouts from the previous revision, and the new layouts created for the new revision. Once the request completes, the result is returned
to the widget through the
onResponse
callback.
Drawing revision creation handler
onDrawingNewRevision: (
drawing: DIQ_DrawingRevision,
storage: DIQ_Storage,
previousLayouts: Array<DIQ_Layout>,
newLayouts: Array<DIQ_Layout>,
onResponse: (result: DIQ_Result) => void
) => {
fetch("/api/drawings/revision", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
drawing,
storage,
previousLayouts,
newLayouts
})
})
.then(() => {
onResponse({ success: true });
})
.catch((error) => {
onResponse({ success: false, error });
});
};