New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

blend-class-system

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blend-class-system

BlendJS Object Oriented Class System For Node.JS

Source
npmnpm
Version
2.5.16
Version published
Weekly downloads
3
-94.92%
Maintainers
1
Weekly downloads
 
Created
Source

BlendJS Core Class System

About:

BlendJS is a full stack JavaScript Web Application Framework. At the moment It is in development and in it's early stages.

But before BlendJS is ready for use I would like to release it's classical class system to anyone who is interested. I hope you enjoy it and let me know if you happen to find any bugs. Don't forget to give this project a star at npmjs.org :)

IMPORTANT: This repository is created to enable BlendJS's class system within Node.js. It does not provide useful functionality in the browser. For the browser version you need to use the BlendJS Web SDK!

Getting Started:

BlendJS's class system implements and provides the following functionality.

  • Define classes using Blend.defineClass(...).
  • Instantiate objects from previously defined classes using Blend.create(...).
  • Extend from existing classes to make custom and specialized classes.
  • Class overriding, that is changing the current implementation of a class without really extending it.
  • Singleton classes, which are classes that have only one instance and are instantiated automatically.
  • Multiple inheritance using mixins. You can mix other classes into your own classes to achieve multiple inheritance.
  • Function overriding, that is the ability to override a function and be able to call it's parent function.
  • Static members. These are functions and properties attached to a class. Great to make utility classes.
  • Automatic namespaces. BlendJS groups your classes into their corresponding namespaces without headache.
  • Automatic dependency resolving. BlendJS (both Node.js and browser versions) automatically resolves class dependencies so you don't need to use require all the time.
  • Integration with Node.js

Defining Classes

To define a class in BlendJS we make use of the Blend.defineClass(...) function, by providing it a FQDN class name and an implementation as a JS object. For example:

Blend.defineClass('MyCRM.models.Person', {
    /**
     * @type {string} A person's firstname
     */
    firstName: null,
    /**
     * @type {string} A person's lastname
     */
    lastName: null,
    /**
     * Gets the fullname of a person
     * @returns {String}
     */
    getFullname: function () {
        var me = this;
        return me.firstName + ' ' + me.lastName;
    }
});
```

Keywords

oop

FAQs

Package last updated on 05 Feb 2015

Related posts