Enumeration ExportJobInterfaceSignal

The ExportJobInterfaceSignal lists all the signals that may be sent by the ExportJobInterface.

These signals are emitted by the ExportJobInterface to monitor the progress of an export job call (DataSessionInterface.export3D, DataSessionInterface.export2D, DataSessionInterface.exportSVG), and when the export job procedure is over (successfully or not).

/** 
* Sample to illustrate the use of a 3d export procedure.
*/
import { DataSessionInterface, WorkingSetInterface, ExportJobInterface, ExportJobInterfaceSignal, InfiniteError, InfiniteEvent, Export3DOutputFormat } from 'generated_files/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession: DataSessionInterface;
// the working set to export as 3d data
let lWorkingSetToExport : WorkingSetInterface;
// the export job to monitor
let lExportJob : ExportJobInterface | undefined = undefined;
// the file to download
// In this test, we will only download one file
let lFileOffset : number = -1;

// triggers a save file from the browser
const onDownloadReady = (pUrl : string) : void => {
const downloadLink = document.createElement('a');
downloadLink.target = '_blank';
// set object URL as the anchors href
downloadLink.href = pUrl;
// append the anchor to document body
document.body.appendChild(downloadLink);
// fire a click event on the anchor
downloadLink.click();
// cleanup: remove element and revoke object URL
downloadLink.remove();
};

const startExportProcedure = () : boolean =>
{
// will will try to export as fbx
lExportJob = lDataSession.export3D(
[{ workingSet: lWorkingSetToExport }],
{
type: 'export3DOutputFormat',
dataFormat: Export3DOutputFormat.EOF_FBX,
// filename without extension
filename: 'test'
}
);
// sanity check
if(lExportJob === undefined)
{
return false;
}
lExportJob.addEventListener(ExportJobInterfaceSignal.ExportJobFinished, (pEvent : InfiniteEvent) : void =>
{
// only get the URL if no error
const lError : InfiniteError | undefined = lExportJob.getLastError();
if(lError === undefined && (lFileOffset === -1))
{
lFileOffset = pEvent.attachments;
if(lExportJob.isExportSuccess(lFileOffset))
{
// trigger the URL computing
if(!lExportJob.computeDownloadURL(lFileOffset))
{
console.log('Export job failed');
}
}
}
});
// URL will be ready
lExportJob.addEventListener(ExportJobInterfaceSignal.ExportJobURLReady, () : void =>
{
const lUrl : string | undefined = lExportJob.getDownloadURL(lFileOffset);
// sanity check
if(lUrl === undefined)
{
console.log('Export job failed');
return;
}
// trigger the download from the browser
onDownloadReady(lUrl);
});
return true;
};

startExportProcedure();

Please refer to ExportJobInterface for more information.
Events

Enumeration Members

ExportFileCountReady: "fileCountReady"

Signal sent by the ExportJobInterface when the number of files is known.

Such an event is fired a short while after calling DataSessionInterface.export3D, DataSessionInterface.export2D or DataSessionInterface.exportSVG.

The attachment is a number telling the number of files of the export procedure.

ExportJobCancelled: "cancelled"

Signal sent by the ExportJobInterface when ExportJobInterface.cancel is called and the export procedure was running.

The ExportJobFinished signal will be triggered shortly after.

The attachment for events of this type is a number telling the file offset that is over, or undefined if all job requests were cancelled.

ExportJobFinished: "finished"

Signal sent by the ExportJobInterface when the 3djuump Infinite backend has finished processing a file in the export job. Even when there was an error, or when the process has been cancelled, the ExportJobFinished signal will be fired.

The attachment for events of this type is a number telling the file offset that is over, or undefined if the procedure failed before retrieving the file count.

ExportJobProgress: "progress"

Signal regularly sent by the ExportJobInterface when the ExportJobInterface 3d export procedure is running to get the progress /state of the procedure (ExportJobInterface.getFileProgress / ExportJobInterface.getFileState).

The attachment is a ExportProgressAttachment.

ExportJobURLReady: "urlReady"

Signal sent by the ExportJobInterface when the ExportJobInterface.getDownloadURL call is ready to be called.

Such an event is fired after ExportJobInterface.computeDownloadURL is called (this call should also be called after receiving the ExportJobFinished signal in case of success).

The attachment is a ExportURLAttachment.