close
Skip to main content
This release is versions behind 2.5.5 — the latest version of @chojs/core.
Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score94%
Published8 months ago (0.0.5)

A tiny decorators based framework for applications

@chojs/core

Core utilities for cho framework.

Component Documentation
Dependency Injection DI

Installation

deno add chojs/core

Dependency Injection Using decorators

@Injectable

Use Injectable to declare a class as a provider. Use DependsOn to declare its dependencies.

import { DependsOn, Injectable } from "@cho/core/di";

@Injectable(DependsOn("foo", "bar"))
class MyService {
  constructor(private foo: string, private bar: number) {
    // foo and bar will be injected by the injector
  }
}

@Module

Use Module decorator to declare a module. Module is a logic container for providers. Module can import other modules to access their providers.

import { imports, Injectable, Module, provide } from "@cho/core/di";

@Module(
  imports(OtherModule),
  provide("foo", () => "bar"),
  provide(MyService),
)
class MyModule {
}

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@chojs/core

Import symbol

import * as core from "@chojs/core";
or

Import directly with a jsr specifier

import * as core from "jsr:@chojs/core";