Jean-Yves Didier

changes to shorten arcsapp description and remove useless fields in JSON

This diff is collapsed. Click to expand it.
......@@ -19,26 +19,22 @@
"controller" : "statemachine",
"sheets" : {
"start" : {
"preconnections" : [],
"postconnections" : [
{ "destination":"loop", "slot":"setIterations", "value":[4] }
],
"connections" : [
{ "source":"loop", "signal":"newIteration", "destination":"dint", "slot":"display" },
{ "source":"loop", "signal":"endLoop", "destination":"statemachine", "slot":"end" }
],
"cleanups" : []
]
},
"start2" : {
"preconnections" : [],
"postconnections" : [
{ "destination":"loop", "slot":"setIterations", "value":[8] }
],
"connections" : [
{ "source":"loop", "signal":"newIteration", "destination":"dint", "slot":"display" },
{ "source":"loop", "signal":"endLoop", "destination":"statemachine", "slot":"end" }
],
"cleanups" : []
]
}
}
}
......
<html>
<head>
<title>ARCS engine</title>
<script data-base-url=".."
<head>
<title>ARCS engine</title>
<meta charset="utf-8"/>
<script data-base-url=".."
data-arcsapp="arcsapp.json"
type="module"
src="../build/arcs_browser.js">
......@@ -11,11 +12,11 @@
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>ARCS in Web Browser</h1>
</head>
<body>
<h1>ARCS in Web Browser</h1>
<div style="height:80vh; overflow: auto; border: solid 1px navy;">
<p id="output" style="margin: 5px; padding: 5px; font-family: monospace;"></p>
<div>
</body>
</body>
</html>
......
{
"name": "arcsjs",
"version": "0.9.3",
"version": "0.9.4",
"description": "Augmented Reality Component System in web browser and node environment",
"homepage": "http://arcs.ibisc.fr",
"repository": {
......
......@@ -37,7 +37,7 @@ let Invocation = function (destination, slot, value) {
* Performs the invocation
*/
this.invoke = function () {
var func = destination[slot];
let func = destination[slot];
if (func === undefined) {
console.error("Undefined slot %s of component %s", slot, destination);
return;
......@@ -80,6 +80,9 @@ Invocation.cast = function (obj, context) {
return new Invocation(component, obj.slot, data);
}
// default invocation without any value
return new Invocation(component, obj.slot);
};
/*ARCS.Invocation.revert = function(obj, context) {
......
......@@ -107,8 +107,8 @@ let Sheet = function (ctx /*context*/) {
};
var removeItem = function(id, tab) {
var i = tab.length;
let removeItem = function(id, tab) {
let i = tab.length;
while ( i-- && tab[i].id !== id );
......@@ -156,10 +156,10 @@ let Sheet = function (ctx /*context*/) {
};
var swapItems = function (id1, id2, tab) {
var item;
let swapItems = function (id1, id2, tab) {
let item;
var i = tab.length, j = tab.length;
let i = tab.length, j = tab.length;
while( i-- && tab[i].id !== id1 ) ;
while( j-- && tab[j].id !== id2 ) ;
......@@ -190,20 +190,28 @@ let Sheet = function (ctx /*context*/) {
};
var cacheConnectionsInvocations = function(object) {
var i = 0, castInvocation = Invocation.cast, castConnection = Connection.cast;
for (i = 0; i < object.preconnections.length; i++) {
preconnections.push(castInvocation(object.preconnections[i], context));
let cacheConnectionsInvocations = function(object) {
let i = 0, castInvocation = Invocation.cast, castConnection = Connection.cast;
if (object.preconnections !== undefined) {
for (i = 0; i < object.preconnections.length; i++) {
preconnections.push(castInvocation(object.preconnections[i], context));
}
}
for (i = 0; i < object.postconnections.length; i++) {
postconnections.push(castInvocation(object.postconnections[i], context));
if (object.postconnections !== undefined) {
for (i = 0; i < object.postconnections.length; i++) {
postconnections.push(castInvocation(object.postconnections[i], context));
}
}
for (i = 0; i < object.cleanups.length; i++) {
cleanups.push(castInvocation(object.cleanups[i], context));
if (object.cleanups !== undefined) {
for (i = 0; i < object.cleanups.length; i++) {
cleanups.push(castInvocation(object.cleanups[i], context));
}
}
if (object.connections !== undefined) {
for (i = 0; i < object.connections.length; i++) {
connections.push(castConnection(object.connections[i], context));
}
}
for (i = 0; i < object.connections.length; i++) {
connections.push(castConnection(object.connections[i], context));
}
};
/**
......@@ -223,7 +231,7 @@ let Sheet = function (ctx /*context*/) {
});
};
var revertInvocation = function (obj) {
let revertInvocation = function (obj) {
return {
destination: context.getComponentName(obj.getDestination()),
slot: obj.getSlot(),
......@@ -231,7 +239,7 @@ let Sheet = function (ctx /*context*/) {
};
};
var revertConnection = function (obj) {
let revertConnection = function (obj) {
return {
source: context.getComponentName(obj.getSource()),
signal: obj.getSignal(),
......@@ -241,12 +249,12 @@ let Sheet = function (ctx /*context*/) {
};
this.toJSON = function () {
var preconns = [];
var postconns = [];
var conns = [];
var cleans = [];
let preconns = [];
let postconns = [];
let conns = [];
let cleans = [];
var i;
let i;
for (i = 0; i < connections.length; i++) {
conns.push(revertConnection(connections[i]))
}
......