mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-14 12:00:45 +08:00
Some checks are pending
CI / Test, build, and verify package (push) Waiting to run
10 lines
555 B
JavaScript
10 lines
555 B
JavaScript
/** Run same-process IM operations without inheriting a browser's UDS identity. */
|
|
export function runHarnessHostOperation(ctx, operation) {
|
|
// Cordis property access requires inject even for an optional service.
|
|
// ctx.get() supports dynamic lookup without making UDS a startup dependency.
|
|
const auth = typeof ctx?.get === 'function' ? ctx.get('udsAuth') : ctx?.udsAuth;
|
|
// Resolve on every call: auth can become ready or reload after IM starts.
|
|
return typeof auth?.runAsHost === 'function'
|
|
? auth.runAsHost(operation)
|
|
: operation();
|
|
}
|