Skip to main content

API Overview

This section provides a comprehensive reference for the Contexify API. Each class, method, and interface is documented in detail with examples to help you understand how to use them effectively.

Core Classes

Contextify is built around a few core classes that provide the foundation for dependency injection:

  • Context - The central registry for bindings and dependencies
  • Binding - Represents a connection between a key and a value
  • ContextView - Tracks a set of bindings that match a specific filter

Decorators

Contextify provides a set of decorators that make it easy to work with dependency injection in TypeScript:

  • @injectable() - Marks a class as injectable
  • @inject() - Injects a dependency by its binding key
  • @inject.tag() - Injects all dependencies that match a specific tag
  • @inject.getter() - Injects a function that can be used to get the dependency later
  • @inject.view() - Injects a ContextView that tracks bindings matching a filter
  • @config() - Injects configuration for the current binding
  • @intercept() - Applies interceptors to a method or class

Interfaces and Types

Contextify defines several interfaces and types that are used throughout the framework:

Usage Examples

For practical examples of using the Contexify API, see the API Usage Examples page. This page provides a variety of examples that demonstrate how to use the API in real-world scenarios.

To learn how to use Contexify effectively in your applications, see the Best Practices section. This section provides guidance on application architecture, dependency injection, and advanced patterns.

For More Information

For more detailed information about the API, please refer to the TypeScript definitions in the source code or check out the example code in the GitHub repository.