Processes
A process is work on the server that goes on after the command that started it, such as a copy in the content tree. It belongs to the user who started it, who sees it again at the next sign-in until they dismiss it.
| Method | Does |
|---|---|
processes() |
the user's processes, oldest first, as ProcessInfo |
processPause(id), processResume(id), processCancel(id) |
pauses at the next checkpoint, resumes, stops |
processDismiss(id) |
forgets a finished process |
onProcess(handler), onProcessDismissed(handler) |
every change to the user's processes, from any of their clients |
A ProcessInfo has an id, kind, title, state, done, total, percent (null while the
total is unknown), status, error, result and its times. state is running, pausing,
paused, cancelling, completed, failed or cancelled.
const started = await store.treeCopy({ id: newsId, parent: archiveId });
const off = store.onProcess(p => {
if (p.id !== started.id) return;
bar.value = p.percent ?? 0;
if (p.state === 'completed') open((p.result as db.TreeCopyResult).id);
});In a plugin, cms.processes.follow(started) shows the process in the CMS interface's own dialog and
notifications (chapter 20).