Toggle navigation
Toggle navigation
This project
Loading...
Sign in
arcs
/
arcs.js
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
3
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Yves Didier
2022-04-02 11:18:34 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f8e4dbf8a65f747f2e1afa2a6396e18a0d757265
f8e4dbf8
1 parent
a1e13ada
changes to shorten arcsapp description and remove useless fields in JSON
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
38 deletions
build/arcs.js
example/arcsapp.json
example/loop.html
package.json
src/invocation.js
src/sheet.js
build/arcs.js
View file @
f8e4dbf
This diff is collapsed. Click to expand it.
example/arcsapp.json
View file @
f8e4dbf
...
...
@@ -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"
:
[]
]
}
}
}
...
...
example/loop.html
View file @
f8e4dbf
<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>
...
...
package.json
View file @
f8e4dbf
{
"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"
:
{
...
...
src/invocation.js
View file @
f8e4dbf
...
...
@@ -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) {
...
...
src/sheet.js
View file @
f8e4dbf
...
...
@@ -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
]))
}
...
...
Please
register
or
login
to post a comment