Skip to content

Latest commit

 

History

History
170 lines (138 loc) · 3.23 KB

README.md

File metadata and controls

170 lines (138 loc) · 3.23 KB

ArmJS

Description:

A lightweight, object-oriented JS framework for quickly creating clearly and structured web applications.

  1. basic objects type: HashMap, ArrayList, Model
  2. built-in objects: Module, Util, Config, Action, Dao, Class, View
  3. create objects
  4. run action

npm install

$ npm i armjs2

see npm: armjs2

import 或 require

example usage arm-example

basic data object

basic data object

Action -> View -> Class -> Dao -> Model
    
Module, defined module info
Action,  control some Object and instancing Class, View
View, DOM process and Event bind
Class, JSON parse, and service logic
Dao, ajax request
Model, JSON object or Object-Class
Config, JSON object, module config
Util, JSON object, static method list

usage

create object

create Module

    var Module = Arm.create('Module', {
        name: 'Module',
        SubModule: {}
    });

create Action

    Module.Action = Arm.create('Action', {
        name: 'Module.Action'
    });

create View

    Module.View = Arm.create('View', {
        name: 'Module.View',
        element: document,
        properties: {
        
        },
        options: {
        
        }
    });

    // XView
    Module.XView = Arm.create('View', {
        name: 'Module.XView',
        element: document,
        properties: {
        },
        options: {
        }
    });

    // SubModule.View
    Module.SubModule.XView = Arm.create('View', {
        name: 'Module.SubModule.XView',
        element: document,
        properties: {
        },
        options: {
        }
    });

create Class

    Module.Class = Arm.create('Class', {
        name: 'Module.Class',
        properties: {
        
        },
        options: {
        
        }
    });

    // XClass
    Module.XClass = Arm.create('Class', {
        name: 'Module.XClass',
        properties: {
        
        },
        options: {
        
        }
    });

    // SubModule.XClass
    SubModule.XClass = Arm.create('Class', {
        name: 'SubModule.XClass',
        properties: {
        
        },
        options: {
        
        }
        // hiherits from class 
    }).inherits(Module.XClass);

create Dao

    Module.Dao = Arm.create('Dao', {
        name: 'Module.Dao',
        getName: function(data, callback) {
            // ajax
        }
    });

    // XDao
    Module.XDao = Arm.create('Dao', {
        name: 'Module.XDao',
        // don no extend from Base module
        extendBase: false,
        getName: function(data, callback) {
            // ajax
        }
    }); 

use instance

    // extends
    Module.Action.get('Class').extend({});
    // run view
    Module.Action.run({});

    // TODO:

speical

tradition multi pages, such as struts of Java Web
also support one page, likes backbone

Example:

    see demo and test, require jQuery, jQuery Tmpl, and Qunit

development install && build

$ npm install
$ npm run build