Release the resource. Resolves once the player confirmed the release (or immediately for purely local resources). Never rejects.
A "Turn feature off" item removes the feature's own menu item at once,
before the plugin stops. dispose takes the command out of the menu and
the binding table and resolves once the player confirmed it; the id can
be added again later.
const extra = plugin.commands.add({ id: "extra", path: ["Tools", "Extra"], run() {} });
plugin.commands.add({
id: "extra-off",
path: ["Tools", "Turn extra off"],
run: () => extra.dispose(), // never rejects
});
The state changed.
Ask to cancel: requested, tooLate (already publishing) or terminal (already over).
The running export stops, unless it is already writing its file.
cancel resolves requested when the worker will stop (the job ends
cancelled), tooLate when it is already publishing the file, and
terminal when the job had already ended.
const answer = await job.cancel();
if (answer === "tooLate") await plugin.osd.show("Too late: the file is being written");
An export, from Snapshot.export. Disposing an unfinished job cancels it.
Remarks
One export, from Snapshot.export.
stateis the SDK's last copy of the job's state: the SDK polls the player about every 350 ms until the job ends, andrefreshreads it at once.doneresolves once the job is terminal (completed,failedorcancelled) and never rejects for a failed export: the failure is inoutcome. Disposing an unfinished job cancels it.Example: Show export progress and cancel on request
The OSD shows the job's status while it runs, and a Cancel command stops it.
onChangefollows the state (queued,running,cancelling, then a terminal one);cancelasks the worker to stop. Afterrequestedthe job usually endscancelled, orfailedwhen the cleanup failed.Since
1.0.0