Home Reference Source Test Repository

Function

Static Public Summary
public

mix(SuperClass: function, mixins: ...function): function

Create a subclass of a constructor and mix 1 or many mixin into it.

public

mixin(target: object, MixedIn: function, args: ...*): object

Mixes in this class's methods into an existing object.

Static Public

public mix(SuperClass: function, mixins: ...function): function source

import {mix} from 'es6-mixin/src/lib/index.js'

Create a subclass of a constructor and mix 1 or many mixin into it.

Params:

NameTypeAttributeDescription
SuperClass function

Class that will be used as super-class

mixins ...function

Mixins to add

Return:

function

A new anonymous class that extends SuperClass and has all mixins mixed in

Test:

public mixin(target: object, MixedIn: function, args: ...*): object source

import {mixin} from 'es6-mixin/src/lib/index.js'

Mixes in this class's methods into an existing object.

Params:

NameTypeAttributeDescription
target object
  • optional
  • default: {}

Any object to mix this class's methods into

MixedIn function
  • optional
  • default: Mixin

Constructor to be mixed in

args ...*
  • optional

Arguments to pass to the mixed in constructor, if any

Return:

object

The original target object, mutated