MCPcopy Create free account
hub / github.com/error311/FileRise / startTransferProgress

Function startTransferProgress

public/js/transferProgress.js:827–872  ·  view source on GitHub ↗
(opts = {})

Source from the content-addressed store, hash-verified

825}
826
827export function startTransferProgress(opts = {}) {
828 ensureUi();
829
830 const job = {
831 id: ++_seq,
832 action: String(opts.action || 'Transferring'),
833 itemCount: Number.isFinite(opts.itemCount) ? opts.itemCount : 0,
834 itemLabel: opts.itemLabel ? String(opts.itemLabel) : 'items',
835 totalBytes: Number.isFinite(opts.totalBytes) ? opts.totalBytes : 0,
836 source: opts.source ? String(opts.source) : '',
837 destination: opts.destination ? String(opts.destination) : '',
838 title: opts.title ? String(opts.title) : '',
839 subText: opts.subText ? String(opts.subText) : '',
840 startedAt: Date.now(),
841 endedAt: 0,
842 showAt: Date.now() + TRANSFER_UI_DELAY_MS,
843 shown: false,
844 estimateBps: readStoredSpeed(),
845 indeterminate: false,
846 state: String(opts.state || 'running').toLowerCase(),
847 error: '',
848 removeAt: 0,
849 dismissed: false,
850 mode: 'estimate',
851 pct: null,
852 bytesDone: null,
853 bytesTotal: null,
854 filesDone: null,
855 filesTotal: null,
856 current: '',
857 lastProgressAt: Date.now(),
858 renderedPct: null,
859 cancelable: !!opts.cancelable && typeof opts.onCancel === 'function',
860 onCancel: (typeof opts.onCancel === 'function') ? opts.onCancel : null,
861 cancelInFlight: false,
862 cancelRequested: false
863 };
864
865 const bytesKnown = opts.bytesKnown !== false;
866 job.indeterminate = !!opts.indeterminate || !bytesKnown || job.totalBytes <= 0;
867
868 _jobs.set(job.id, job);
869 ensureTicking();
870 renderAll();
871 return job;
872}
873
874export function updateTransferProgress(jobRef, updates = {}) {
875 const job = resolveJob(jobRef);

Callers 4

runTransferJobFunction · 0.85
startProBundleProgressFunction · 0.85
fileActions.jsFile · 0.85

Calls 5

ensureUiFunction · 0.85
readStoredSpeedFunction · 0.85
ensureTickingFunction · 0.85
setMethod · 0.80
renderAllFunction · 0.70

Tested by

no test coverage detected