The system package is the root for the VEGAS JS framework. It is the starting point of our RIA framework structure : signals, W3C events, datas and collections (ADT), IoC container (Dependency Injection), logger, tasks, transitions, logics, rules, models, etc.
Vegas JS | System - version 1.0.0 is an Opensource Library based on ECMAScript for develop crossplatform Rich Internet Applications and Games.
This library is the root package for the VEGAS JS framework. It is the starting point of our RIA framework structure : signals, data, IoC, logger, tasks, transitions, logics, rules, models, etc.
Under tree opensource licenses :
Download on Bitbucket the latest code, report an issue, ask a question or contribute :
Get started with the the Vegas JS API :
Send us your email to join the VEGAS community on Slack !
You can install VEGAS JS with Yarn or NPM.
yarn add vegas-js-system
or
npm install vegas-js-system
1 - Load the ./dist/vegas-system.js library in your HTML page.
The index.html file :
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Test VEGAS JS | System</title>
</head>
<body>
<script src="./js/vegas-system.js"></script>
<script src="./js/index.js"></script>
</body>
</html>
2 - Use the system package in your javascript application.
The index.js file :
"use strict" ;
window.onload = function()
{
if( !system )
{
throw new Error("The VEGAS JS - System library is undefined.") ;
}
const signals = system.signals ;
// ------
function Slot( name )
{
this.name = name ;
}
Slot.prototype = Object.create( signals.Receiver.prototype );
Slot.prototype.constructor = Slot;
Slot.prototype.receive = function ( message )
{
console.log( this + " : " + message ) ;
};
Slot.prototype.toString = function ()
{
return "[Slot name:" + this.name + "]" ;
};
// ------
let slot1 = new Slot("slot1") ;
let slot2 = function( message )
{
console.log( this + " : " + message ) ;
};
let signal = new signals.Signal() ;
//signal.proxy = slot1 ;
signal.connect( slot1 , 0 ) ;
signal.connect( slot2 , 2 ) ;
console.log( "signal.connected : " + signal.connected() ) ;
console.log( "signal.length : " + signal.length ) ;
console.log( "signal.hasReceiver(slot1) : " + signal.hasReceiver(slot1) ) ;
console.log( "signal.hasReceiver(slot2) : " + signal.hasReceiver(slot2) ) ;
signal.emit( "hello world" ) ;
signal.disconnect( slot1 ) ;
signal.emit( "Bonjour monde" ) ;
};
VEGAS JS | Signals use Yarn with a set of powerful packages (Babel, Mocha, etc.) to compile and build this library.
1 - The first time, initialize the project and run yarn :
yarn
2 - Run the Unit Tests + Compile all the libraries + Generates the documentation :
yarn build
1 - Build the ./dist/vegas-system.js : not minified + no comments + sourcemap.
yarn dev
2 - Build the ./dist/vegas-system.js and watch the changing into the ./src folder.
yarn watch
3 - Build the ./dist/vegas-system.min.js : minified + no comments.
yarn prod
We use the Mocha and the Chai (http://chaijs.com/) tools to run the unit tests of the VEGAS JS libraries.
1 - Run all unit tests
$ yarn test
2 - Run a specific library, use one of this command :
The --match option trigger the unit test engine (based on Mocha) to only run tests matching the given pattern which is internally compiled to a RegExp, for examples :
$ yarn test -g system.signals.Receiver
The --reporter option define the unit test result rendering in the terminal with the values : 'spec', 'dot', 'landing', 'dot', 'nyan', 'list', 'mochawesome'. By default the 'spec' value is used.
yarn test --reporter nyan
3 - Cover the library source code with Istanbul :
yarn cover
The documentation of the framework is based on JSDoc.
Run the documentation build with gulp :
yarn doc
The documentation is generated in the folder : ./docs/bin