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 along with its updated layouts. Once the request completes, the result is returned to the widget through the
onResponse
callback.
Drawing revision creation handler
onDrawingNewRevision: (
drawing: DIQ_DrawingRevision,
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,
previousLayouts,
newLayouts
})
})
.then(() => {
onResponse({ success: true });
})
.catch((error) => {
onResponse({ success: false, error });
});
};