0.2.4 • Published 11 years ago

esf-javascript-core v0.2.4

Weekly downloads
19
License
-
Repository
bitbucket
Last release
11 years ago

This is a lightweight classloader that is heavily inspired by the Ext.ClassManager. To keep it simple there are no additional dependencies. See esf-web-core package for dynamicaly loading files by json etc.

Installation

Browser:

<script type="text/javascript" src="lib/core.js" />

Node-JS:

$ npm install esf-javascript-core

Todo

  • Add multiple inheritance
  • Add tags
  • Add singletons
  • Add private, protected, static methods
  • Add namespace mapping
  • Create more meanfull error messages
  • Create test cases

Simple example

Esf.define('A', {
    a: null,

    constructor: function (a) {
        // Save var
        this.a = a;

        // Heyho
        console.log('A');
    },
    foo: function (b) {
        console.log('foo - ' + b);
    }
});

Esf.define('B', {
    b: null,

    constructor: function (a, b) {
        // Call super constructor
        this.callParent(a);

        // Save var
        this.b = b;

        // Heyho
        console.log('B');
    },
    foo: function () {
        this.callParent('bar');
    }
}, {
    extend: 'A'
});

// Use
var b = new B(1, 2);

// or
var b = Esf.create('B', 1, 2);

/*
 * Output:
 * A
 * B
 * foo - bar
 */
b.foo();
0.2.4

11 years ago

0.2.3

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.9

11 years ago