MMOframework
Why AI Playground Libraries Documentation Search Agency
FR EN
Index

mmo-job

1 symbol · generated 27 Oct 2026

element

mmo-job

mmo-job.jhs:1

Follows a long job of the server (mmo.core's JobController) live: its state, its progress, its log, its result or its error, as the job reports them (Server-Sent Events, api/jobs/{id}/events.sse). Leaving the page does not stop the job: coming back shows it again, from its start, still running or ended.

<mmo-job url="api/jobs" job job-id params></mmo-job>
Extends
CustomShadowElement
Which job: - `job-id`: that one; - `job`: the name the application declares it under (`JobController`'s `jobs`): the one running, else the last one; « Run » starts a new one with `params`, and the earlier runs are listed to look at again. Events: `jobstart` (a job was started, `detail` its record), `jobprogress` (`detail` {done, total, percent, label}), `jobend` (`detail` its record: `state` is `done`, `stopped` or `failed`). > The job's `html` events are shown as html: a job writes only html it controls (it escapes its data).
<mmo-job job="atonline" params='{"limit": 10}'></mmo-job> <mmo-job job-id="20261019-142501-a1b2c3d4"></mmo-job>

Index

urlwhere the jobs' api answers (api/jobs, relative to the site)
jobthe declared name of the job: follow its current run, and start new ones
job-idthe id of the job to follow
paramsthe parameters « Run » starts the job with (json)
job accessorThe declared name of the job
jobId accessorThe id of the job followed
params accessorThe parameters « Run » starts the job with
current readonly accessorThe record of the job followed: {id, job, title, state, progress, result, error, created, started, ended, info}
constructor()
init()
disconnectedCallback()
isActive()Whether the job followed is still queued or running
load()Follow the job of job-id, else the current or last run of job, and list job's earlier runs.
loadHistory()The earlier runs of job, newest first, in the select of the header
run(params)Start a new run of job, and follow it
stop()Ask the job followed to stop (it stops at its next check)
attach(id)Follow a job: its log from its start, then live until it ends
detach()Stop following the job (it goes on running).
setRecord(record)Show a job's record: its title, state, progress
receive(event)Show one of the job's events
setProgress(progress)Show how far the job is
addLine(level, content, time)Add a line to the log
update()Update the header: title, state, buttons
tick(on)Refresh the time it took every second, while the job runs
showTime()Show how long the job ran (or runs)
fillHistory(list)List the earlier runs in the header
downloadLogs()Download the log, as html
clearLogs()Empty the log shown (the job's own stays on the server)

Attributes4

url

mmo-job.jhs

where the jobs' api answers (api/jobs, relative to the site)

url="api/jobs"

job

mmo-job.jhs

the declared name of the job: follow its current run, and start new ones

job

params

mmo-job.jhs

the parameters « Run » starts the job with (json)

params

Properties4

job

accessormmo-job.jhs:67

The declared name of the job

get job() set job(value)
Type
?string

jobId

accessormmo-job.jhs:80

The id of the job followed

get jobId() set jobId(value)
Type
?string

params

accessormmo-job.jhs:93

The parameters « Run » starts the job with

get params() set params(value)
Type
Object

current

readonlyaccessormmo-job.jhs:107

The record of the job followed: {id, job, title, state, progress, result, error, created, started, ended, info}

get current()
Type
?Object

Methods20

isActive()

mmo-job.jhs:115

Whether the job followed is still queued or running

isActive()
returnsboolean

load()

mmo-job.jhs:126

Follow the job of job-id, else the current or last run of job, and list job's earlier runs.

load()
returnsPromise

loadHistory()

mmo-job.jhs:140

The earlier runs of job, newest first, in the select of the header

loadHistory()
returnsPromise<Array>their records

run(params)

mmo-job.jhs:158

Start a new run of job, and follow it

run(params = null)
params = null?Object- its parameters (default: params)
returnsPromise<Object>its record

stop()

mmo-job.jhs:179

Ask the job followed to stop (it stops at its next check)

stop()
returnsPromise

attach(id)

mmo-job.jhs:190

Follow a job: its log from its start, then live until it ends

attach(id)
idstring

detach()

mmo-job.jhs:221

Stop following the job (it goes on running).

detach()

setRecord(record)

mmo-job.jhs:233

Show a job's record: its title, state, progress

setRecord(record)
recordObject

receive(event)

mmo-job.jhs:244

Show one of the job's events

receive(event)
eventObject- {id, t, type, ...}

setProgress(progress)

mmo-job.jhs:286

Show how far the job is

setProgress(progress)
progressObject- {done, total, percent, label}

addLine(level, content, time)

mmo-job.jhs:300

Add a line to the log

addLine(level, content, time = null)
levelstring- a log level, or html, result, error
contentstring | Node- text (shown as text) or a node
time = null?number- when, in seconds

tick(on)

mmo-job.jhs:330

Refresh the time it took every second, while the job runs

tick(on)
onboolean

fillHistory(list)

mmo-job.jhs:355

List the earlier runs in the header

fillHistory(list)
listArray- their records, newest first

clearLogs()

mmo-job.jhs:375

Empty the log shown (the job's own stays on the server)

clearLogs()