MCPcopy Index your code
hub / github.com/CapSoftware/Cap / createExportTask

Function createExportTask

apps/desktop/src/utils/export.ts:16–44  ·  view source on GitHub ↗
(
	projectPath: string,
	settings: ExportSettings,
	onProgress: (progress: FramesRendered) => void,
)

Source from the content-addressed store, hash-verified

14}
15
16export function createExportTask(
17 projectPath: string,
18 settings: ExportSettings,
19 onProgress: (progress: FramesRendered) => void,
20) {
21 const progress = new Channel<FramesRendered>((e) => {
22 onProgress(e);
23 });
24 let closed = false;
25 const closeProgress = () => {
26 if (closed) return;
27 closed = true;
28 const internals = (
29 globalThis as {
30 __TAURI_INTERNALS__?: { unregisterCallback?: (id: number) => void };
31 }
32 ).__TAURI_INTERNALS__;
33 internals?.unregisterCallback?.(progress.id);
34 };
35 const cancel = () => {
36 if (closed) return;
37 void cancelCurrentWindowExports();
38 closeProgress();
39 };
40 const promise = commands
41 .exportVideo(projectPath, progress, settings)
42 .finally(closeProgress);
43 return { promise, cancel };
44}
45
46async function cancelCurrentWindowExports() {
47 await commands.cancelCurrentWindowExports().catch((error) => {

Callers 2

exportWithSettingsFunction · 0.90
exportVideoFunction · 0.85

Calls 1

onProgressFunction · 0.50

Tested by

no test coverage detected