Skip to main content

onListDrawings

Last updated 8/03/2026

Drawing listing handler

This example demonstrates how the

callback sends a request using the Fetch API to retrieve drawings for a revision. Once the request completes, the result and returned drawings are provided to the widget through the

onResponse
callback.

TypeScript
Drawing listing handler
onListDrawings = async function(revision: DIQ_Revision, onResponse: (result: DIQ_Result, drawings: Array<DIQ_DrawingRevision> | null) => void) {
try {
const res = await fetch(`/api/revisions/${revision.key}/drawings`);

if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}

const drawings = await res.json();

onResponse(
{ ok: true },
drawings
);

} catch (err) {
onResponse(
{
ok: false,
message: err.message || "Failed to fetch drawings"
},
null
);
}
};