Skip to main content
Module

x/mixwithts/mod.ts>wrap

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

Sets up the function mixin to be wrapped by the function wrapper, while allowing properties on mixin to be available via wrapper, and allowing wrapper to be unwrapped to get to the original function.

wrap does two things:

  1. Sets the prototype of mixin to wrapper so that properties set on mixin inherited by wrapper.
  2. Sets a special property on mixin that points back to mixin so that it can be retreived from wrapper

type

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