Jean-Yves Didier

fixes in order to pass the loop test

This diff is collapsed. Click to expand it.
/* ugly hack in order to display data in web page instead of console */
import ARCS from '../build/arcs.js';
var Console;
let Console;
/**
* @class Console
* @classdesc Redirects console messages to a given HTML element in the page.
......@@ -44,3 +44,4 @@ Console = ARCS.Component.create(
export default { Console: Console};
//export default {};
......
......@@ -6,7 +6,6 @@
*/
import ARCS from '../build/arcs.js';
/**
* @class Loop
* @classdesc loop component creation using a compact style.
......
......@@ -217,4 +217,4 @@ Component.create(Application);
Application.slot("setSheet");
Application.slot("finish");
export default {Application: Application};
export default Application;
......
import ARCS from './arcs.js';
/**
* Bootstrap for the ARCS engine in a browser environment.
......@@ -9,7 +7,7 @@ import ARCS from './arcs.js';
"use strict";
// basically, here we start by importing the module ARCS
import ARCS from './arcs.js';
import ARCS from './exports.js';
console.log("[ARCS] Bootstrapping...");
......
......@@ -189,4 +189,4 @@ var Component = {
}
};
export default { Component: Component};
export default Component;
......
......@@ -57,4 +57,4 @@ Connection.cast = function (obj, context) {
};
export default { Connection: Connection};
export default Connection;
......
......@@ -20,7 +20,7 @@ let Context = function( ctx ) {
var instanciateComponents;
factories.StateMachine = Statemachine;
factories.StateMachine = StateMachine;
if (ctx !== undefined) {
......@@ -140,6 +140,7 @@ let Context = function( ctx ) {
// TODO promisify call to cbFunction
return import(/* webpackIgnore: true */libUrl).then( function(module) {
// TODO insert here component factories
for (p in module.default) {
if (module.default.hasOwnProperty(p)) {
Context.currentContext.setFactory(p,module.default[p]);
......@@ -149,7 +150,7 @@ let Context = function( ctx ) {
if (cbFunction !== undefined) {
cbFunction();
}
}).catch( function(msg) { console.error("[ARCS] Trouble loading '",libUrl,"' with reason -", msg) });
}).catch( function(msg) { console.error("[ARCS] Trouble loading '",libUrl,"' with reason -", {msg}) });
};
/**
......@@ -314,5 +315,5 @@ let Context = function( ctx ) {
/** pseudo-singleton to current context being used */
Context.currentContext = null;
export default {Context: Context};
export default Context;
......
......@@ -662,4 +662,4 @@ let EventLogicParser = (function() {
};
})();
export default { EventLogicParser: EventLogicParser};
export default EventLogicParser;
......
......@@ -9,7 +9,7 @@ import Connection from './connection.js';
import Sheet from './sheet.js';
import Application from './application.js';
export default {
let ARCS = {
Component: Component,
isInNode : isInNode,
StateMachine: StateMachine,
......@@ -19,3 +19,5 @@ export default {
Sheet: Sheet,
Application: Application
};
export default ARCS;
......
......@@ -66,4 +66,4 @@ Invocation.PRE_CONNECTION = 0;
Invocation.POST_CONNECTION = 1;
Invocation.CLEAN_UP = 2;
export default { Invocation: Invocation};
export default Invocation;
......
......@@ -272,4 +272,4 @@ let Sheet = function (ctx /*context*/) {
context.setParent(ctx);
};
export default {Sheet: Sheet};
export default Sheet;
......
......@@ -11,7 +11,8 @@ import EventLogicParser from './eventlogicparser.js';
* @param obj {object} an object describing a state machine. If obj is empty then the statemachine is empty
* @class
*/
let Statemachine = new Component.create(function (obj) {
let StateMachine = Component.create(function (obj) {
// dynamic construction: properties are initial state that have properties
// that are tokens and value that are the final state
var initial = "", final = "", transitions = {}, currentState = "", self= this;
......@@ -20,7 +21,7 @@ let Statemachine = new Component.create(function (obj) {
var network = {};
var addToken = function(t) {
var addToken = function(t) {
if ( self.slots.indexOf(t) < 0 ) {
self.slots.push(t);
self[t] = function( s ) {
......@@ -88,7 +89,7 @@ let Statemachine = new Component.create(function (obj) {
var t, tsd, ts, tsc;
try {
var tsd = ARCS.EventLogicParser.parse(token);
var tsd = EventLogicParser.parse(token);
if (typeof tsd === "string") {
addToken(tsd);
} else {
......@@ -151,7 +152,7 @@ let Statemachine = new Component.create(function (obj) {
* the initial state (by default, it is the departure of the first transition
*/
this.start = function () {
console.log("statemachine", this, initial,obj);
//console.log("statemachine", this, initial,obj);
setSheet(initial);
};
......@@ -169,4 +170,4 @@ let Statemachine = new Component.create(function (obj) {
['requestSheet', 'requestTermination']
);
export default { StateMachine: StateMachine};
export default StateMachine;
......
......@@ -19,4 +19,4 @@ let TokenEvent = function() {
};
};
export default {TokenEvent: TokenEvent};
export default TokenEvent;
......
......@@ -56,4 +56,4 @@ TransitionNetwork.build = function(tree, tokenEvents) {
return res;
};
export default {TransitionNetwork: TransitionNetwork};
export default TransitionNetwork;
......
......@@ -42,4 +42,4 @@
}
}
}
\ No newline at end of file
......
const path = require('path');
module.exports = {
entry: './src/exports.js',
experiments : {
outputModule: true
},
entry: {
'arcs' : {
import : './src/exports.js',
},
'arcs_browser' : {
import : './src/arcs_browser.js'
//dependOn : ['arcs']
}
},
mode: 'none',
output: {
filename: 'arcs.js',
filename: '[name].js',
path: path.resolve(__dirname, 'build'),
library: {
type: 'module',
}
},
module: {
parser: {
......