mixto
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/mixto package

1.0.0 • Public • Published

Mixto: A simple mixin superclass Build Status

To create a mixin, subclass mixto:

Mixin = require 'mixto'
 
class MyMixin extends Mixin
  @classMethod: -> console.log("foo")
  instanceMethod: -> console.log("bar")

Then mix into classes with .includeInto:

class MyClass
  MyMixin.includeInto(this)
  
MyClass.classMethod()
(new MyClass).instanceMethod()

Or extend individual objects with .extend:

myObject = {a: 1, b: 2}
MyMixin.extend(myObject)
myObject.instanceMethod()

Or build standalone instances of your 'mixin':

standalone = new MyMixin
standalone.instanceMethod()

Readme

Keywords

Package Sidebar

Install

npm i mixto

Weekly Downloads

1,273

Version

1.0.0

License

none

Last publish

Collaborators

  • atom-team
  • nathansobo
  • kevinsawicki
  • benogle