Add web worker hooks
This release introduces useWebWorker, a reactive wrapper around a web worker that surfaces its messages and errors as state, and useWebWorkerCallback, which runs a self-contained function in a worker without a separate worker file and returns a promise.
Features
useWebWorker— added a hook that wraps a web worker, exposingdata,error,terminated,post,restart, andterminate, and accepting the nativename,type, andcredentialsoptions alongsideonMessageandonErrorcallbacks.useWebWorker— the hook accepts either a script URL or an existingWorkerinstance, taking ownership of the instance so it is terminated on unmount, and recreates the worker whenever the source or the native options change.useWebWorker— added arestartmethod to recreate a worker after it has been terminated, sincepostis silently ignored once the worker is gone and there is otherwise no way back.useWebWorker— errors fromerrorandmessageerrorevents are captured inerror, which is the only channel for failures that happen inside the worker thread and can never be caught withtry/catcharoundpost.useWebWorkerCallback— added a hook that runs a callback in a worker built from its source at call time, exposingpending,run, andterminate, withrunreturning a promise that resolves with the callback result or rejects with its error.useWebWorkerCallback— the worker and its object URL are created per call and released once the promise settles, and only one call may be in flight at a time, so a secondrunrejects while the first is still running.