JSPM

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

represent a Class design pattern for JavaScript included multible namespaces, options and functions

Package Exports

  • crisp-create

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 (crisp-create) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Crisp.CreateJS

represent a Class design pattern for JavaScript included multible namespaces, options and functions

Build Status NPM Downloads NPM Version

// create object
var myObject = Crisp.utilCreate();

// initialice object
myObject.objIni();

// get object option
myObject._('myoption');

// clone object without data
var cloneObject = myObject.objClone();

Index Table

Getting Started

Server-Nodes

Use Node Package Manager (npm) to install crisp-create for Node.js and io.js

$ npm install crisp-create
// use package
require("crisp-create");

or use the OpenCrisp UtilJS wraper

$ npm install crisp-util
// use package
require("crisp-util");

Web-Clients

Use Bower to install crisp-create for Browsers APP's and other front-end workflows.

$ bower install crisp-create
<!-- use package -->
<script type="text/javascript" src="dist/crisp-create.min.js"></script>

or use the OpenCrisp UtilJS wraper

$ bower install crisp-util
<!-- use package -->
<script type="text/javascript" src="dist/crisp-util.min.js"></script>

Development

Use Git to clone Crisp.CreateJS from GitHub to develop the repository with Grunt

# Clone:
$ git clone https://github.com/OpenCrisp/Crisp.CreateJS.git

# Build: test, concat, test, minify, test
$ grunt

# Test: original sourcecode for developer (included in build)
$ grunt t

# Run all test-scripts on Unix
$ sh grunt-tests.sh

Usage

How to use Crisp.CreateJS function in JavaScript.

Crisp.utilCreate()

How to use Crisp.utilCreate( option ) with util.create namespace.

var myObject = Crisp.utilCreate({
    ns: []
    options: {},
    prototypes: {},
    properties: {}
});

option.ns utilCreate()

var myObject = Crisp.utilCreate({
    ns: ['util.event']
}).objIni();

myObject.objNs('util.event');   // true
myObject.xTo();                 // '{}'

option.options utilCreate()

var myObject = Crisp.utilCreate({
    options: {
        a: { proWri: true }
    }
}).objIni({ a: 'A' });

myObject._('a'); // 'A'
myObject.xTo();  // '{}'

option.properties utilCreate()

var myObject = Crisp.utilCreate({
    properties: {
        b: {
            proEnu: true,
            proGet: function() { return 'B'; }
        }
    }
}).objIni();

myObject.b;      // 'B'
myObject.xTo();  // '{"b":"B"}'

option.prototypes utilCreate()

var myObject = Crisp.utilCreate({
    prototypes: {
        c: function() { return 'C'; }
    }
}).objIni();

myObject.c();    // 'C'
myObject.xTo();  // '{}'

CreateJS function

.objIni()

How to use .objIni( option ) function on utilCreate object.

var myObject = Crisp.utilCreate({
  options: {
    test: {}
  }
}).objIni({
    test: 0
});

myObject._('test');     // 0

._()

How to use ._( name OR option ) function on utilCreate object.

// get the value of `test`
myObject._('test');
// or with option
myObject._({ name: 'test' });

// returns preset if option is undefined
myObject._({ name: 'test', preset: 0 });
// or preset of function
myObject._({ name: 'test', preset: function() { return 0; } });

// returns preset if option is undefined and save the value on option
myObject._({ name: 'test', insert: true, preset: 0 });
// or preset of function
myObject._({ name: 'test', insert: true, preset: function() { return 0; } });

.objSet()

How to use .objSet( name, value ) function on utilCreate object.

myObject.objSet('test', 1 );

.objData()

How to use .objData( option ) function on utilCreate object.

myObject.objData({
    a: 'A'
});

myObject.a;  // 'A'

.objClone()

How to use .objClone() function on utilCreate object.

var cloneObject = myObject.objClone();

.objNs()

How to use .objNs( name ) function on utilCreate object.

myObject.objNs('util.create');  // true

'util.create' is an default namespace