Skip to content

Workers

ActionScript’s workers (flash.system.Worker) run on Web Workers by default, as in Flash. configure({ workers: false }) turns them off for the page, and workers="false" or "true" on an element for its own SWFs. Under an import map, map @swf2es/player-hosts/workers too, or SWFs play without workers (the console says why). The workers load @swf2es/player-hosts’ dist/thread/, which needs no import map, from wherever the package is served (a CDN’s needs CORS, and under a Content-Security-Policy, worker-src with the CDN’s origin and blob:: the worker starts on a blob: module of the page’s that imports the script, and a module worker’s imports are held to worker-src too); configure({ workerUrl }) names another script, such as a bundler’s. Sharing memory between workers (a shareable ByteArray, Mutex, Condition) needs a cross-origin isolated page: serve it with Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: credentialless. Elsewhere workers only pass messages, and sharing throws an error that says so (workers.md).