Socket
Socket
Sign inDemoInstall

coop

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    coop

Co-operative multiple inheritance for JavaScript


Version published
Weekly downloads
1
decreased by-95.24%
Maintainers
1
Install size
30.5 kB
Created
Weekly downloads
 

Readme

Source

Co-Op provides Pythonic cooperative multiple inheritance to Javascript and Node.js.

Build Status

Installation

npm install coop

Usage

Creating a class is similar to Mootools:

var Class = require('coop').Class;
var MyClass = new Class({
  initialize: function(me) {
    this.me = me;
  }
});

Inheritance

...is a little different from Mootools. But orders of magnitude more powerful.

var MySubClass = new Class([MyClass, MyOtherClass], {
  initialize: function (me) {
    this.super_initialize(MySubClass, arguments);
  }
})

Metaclasses

Make your own subclass of Class, and override new, just like you do in Python:

var MyMetaClass = new Class([Class], {
  __new__: function (klass) {
    var instance = this.super___new__(MyMetaClass, arguments);

    registerMyClass( instance );

    return instance;
  }
})

var MyClass = new MyMetaClass({
  initialize: function () { /* ... */ }
})

Keywords

FAQs

Last updated on 16 Jun 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc