JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28
  • Score
    100M100P100Q40467F
  • License MIT

JavaScript classical inheritance pattern library

Package Exports

  • class-256.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (class-256.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

class-256.js

class-256.js is a very small (256 bytes minified, or 398 bytes with UMD pattern) JavaScript classical inheritance pattern library. Originally based on augment and extend.

API

var HelloWorld = Class.extend(function() {
    this.hello = 'Hello '; // public property

    var world = 'World!'; // private property

    this.constructor = function() { // constructor method
        privileged.call(this);
    };

    this.say = function(msg) { // public method
        console.log(msg);
    };

    function privileged() { // private method
        this.say(this.hello + world);
    }
});

var HelloWorld2 = HelloWorld.extend(function(parent) {
    this.hello = 'Hi ';

    this.constructor = function() {
        parent.constructor.apply(this, arguments); // call parent contructor
    };
});

Installation

NPM

npm install class-256.js

Bower

bower install class-256.js

Browser

<script src="https://github.com/koffeine/class-256.js/blob/master/dist/class.umd.min.js" charset="utf-8"></script>

Files

  • dist/class.js: no UMD, unminified
  • dist/class.min.js: no UMD, minified
  • dist/class.umd.js: UMD, unminified
  • dist/class.umd.min.js: UMD, minified

License

Copyright © 2015 Horváth Kornél

Licensed under the MIT License.