Socket
Socket
Sign inDemoInstall

allot

Package Overview
Dependencies
3
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    allot

Utils for classes


Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Install size
515 kB
Created
Weekly downloads
 

Readme

Source

Allot

A way of defining interfaces from one JavaScript class to a new class.

The idea is still a little abstract at the moment however its useful for building quick interfaces from one class to another.

Full documentation

Usage

allot.inherits

Classical inheritance to JavaScript, however methods are not copied or referenced they use the proxy methods defined in this module.


function SuperClass() {
};

SuperClass.thing = function () {
  return 'thing';
};

SuperClass.prototype.doSomething = function () {
  return 'Hello there';
};

var ChildClass = allot.inherits(function () {}, SuperClass);

ChildClass.thing();

var instance = new ChildClass();
instance.doSomething();

allot.factory

Builds a new class based upon SuperClass.

Static methods from instance methods

function SuperClass() {
};

SuperClass.prototype.doSomething = function () {
  return 'Hello there';
};

var ChildClass = allot.factory(SuperClass, {
  staticProxyPrototypes: ['doSomething']
});

ChildClass.doSomething();

var instance = new ChildClass();

Static methods from static methods

function SuperClass() {
};

SuperClass.doSomething = function () {
  return 'Hello there';
};

var ChildClass = allot.factory(SuperClass, {
  staticProxyMethods: ['doSomething']
});

ChildClass.doSomething();

var instance = new ChildClass();

Status

Build Status Coverage Status Dependency Status devDependency Status

Browser Support

Licence

Copyright (c) 2014 Jonathan Kingston

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

FAQs

Last updated on 10 Feb 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