Skip to main content
Module

x/mixwithts/mod.ts>Cached

TypeScript compatible version of Justin Fagani's mixin library for ES6
Latest
variable Cached
import { Cached } from "https://deno.land/x/mixwithts@1.1.2/mod.ts";

Decorates mixin so that it caches its applications. When applied multiple times to the same superclass, mixin will only create one subclass, memoize it and return it for each application.

Note: If mixin somehow stores properties its classes constructor (static properties), or on its classes prototype, it will be shared across all applications of mixin to a super class. It's reccomended that mixin only access instance state.

type

<C extends Constructable, T>(mixin: mixin<C, T>) => unknown