Skip to main content

ScopeRegisterโ€‹

ScopeRegister serves as the main entry point for working with scopes. It allows you to register custom scopes, deregister them and check if they are registered.

See @Scope and Custom Scopes for more information.

Methods overviewโ€‹

.registerScope()โ€‹

This method allows you to register a new Custom Scope and use it for beans.

Throws DuplicateScopeError if the scope is already registered.

import { Scope, ScopeRegister } from '@clawject/di';

class MyScope implements Scope { /* ... */ }

ScopeRegister.registerScope('my-scope', MyScope);

.hasScope()โ€‹

Check whether the scope with the given name is registered. Returns true if scope by given name exists, or false if the scope does not exist.

import { ScopeRegister } from '@clawject/di';

const hasScope = ScopeRegister.hasScope('my-scope');