dandi

🌻A modular DI, MVC, and Model binding/validation framework for NodeJS and TypeScript or ES6

View the Project on GitHub just-dandi/dandi

@dandi/common

@dandi/common provides common types and utilities for the rest of the @dandi system.

@dandi/common does not have any dependencies on NodeJS, and therefore can be used on classes shared with projects targeted for the web.

Disposable

The Disposable interface allows implementing classes to define behavior for cleaning up resources like IO streams, database connections, as well as Observable and other event subscriptions.

When used with @dandi/core, Disposable instances are automatically disposed by Dandi at the end of their lifecycle.

class MyService implements Disposable {

    constructor(private dbClient: DbClient) {}

    public dispose(reason: string): void {
        this.dbClient.release();
    }

}

Disposable Utilities

Disposable is also a static class provides several utility functions: