Examples > job-runner PLUGIN.JS (1/2) File: examples/plugins/job-runner/plugin.js (50 lines) // job-runner: actions an outside program can trigger through the job queue. // // POST /api/plugin-jobs {"plugin":"job-runner","action":"save","args":{"url":"https://.../book.epub"}} // GET /api/plugin-jobs/status?id=N // // Jobs run only while a page hosting this plugin is open: /plugins, or the // headless runner /plugins-run. args and result must each stay < 192 bytes. // See companions/job-runner/send-to-reader.sh. CrossPoint.registerPlugin((container, api) => { const b64 = (t) => { let s = ''; for (const c of new TextEncoder().encode(t)) s += String.fromCharCode(c); return btoa(s); }; const INBOX = '/Books/Inbox'; // A visible card on /plugins with a manual form, nice for testing. container.innerHTML = `

Job Runner Example

Book URL

`; Next: 04 plugin.js (2/2)