Skip to main content
containerRegistry maps scope objects to Container instances. It backs resolve(), request scope, and React Native-safe multi-container apps.

Global singleton

Scoped registration

API

Uses WeakMap for long-lived scope keys and Map for transient scopes (React Native safe, without FinalizationRegistry).

ROOT_SCOPE

Sentinel constant for the root scope bucket in internal scoped caches.

Integration with ALS

getContainer() without arguments calls getActiveScope() from request scope store. When ALS has an active scope and a container is registered for it, that container wins over the default.

inject.setGlobalContainer

Convenience wrapper around setDefaultContainer:

Error

Throws DependencyError when no default container exists and no scoped container matches:
See resolve & inject.