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
2021-08-31 12:36:43 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
465193921e78844b419732ee086f4a5086eaf55c
46519392
1 parent
64ca04ff
added an entry in invocations to look up to localstorage
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
17 deletions
build/arcs.js
build/arcs.min.js
components/console.js
src/arcsapp_bundler.js
src/invocation.js
build/arcs.js
View file @
4651939
/******/
"use strict"
;
/******/
var
__webpack_modules__
=
([
/* 0 */
/***/
((
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
=>
{
...
...
@@ -1635,20 +1634,35 @@ let Invocation = function (destination, slot, value) {
* @param context {object} the context in which this invocation takes place.
* @return an invocation
*/
Invocation
.
cast
=
function
(
obj
,
context
)
{
if
(
obj
.
value
!==
undefined
)
{
var
component
=
context
.
getComponent
(
obj
.
destination
);
if
(
component
===
undefined
)
{
Invocation
.
cast
=
function
(
obj
,
context
)
{
let
component
=
context
.
getComponent
(
obj
.
destination
);
if
(
component
===
undefined
)
{
console
.
error
(
"[ARCS] Destination "
,
obj
.
destination
,
" is undefined"
);
}
}
if
(
obj
.
value
!==
undefined
)
{
return
new
Invocation
(
component
,
obj
.
slot
,
obj
.
value
);
}
// this one looks odd, seems there is a failure in the logic.
if
(
obj
.
ref
!==
undefined
)
{
return
new
Invocation
(
co
ntext
.
getComponent
(
obj
.
destination
)
,
obj
.
slot
,
context
.
getConstant
(
obj
.
ref
));
return
new
Invocation
(
co
mponent
,
obj
.
slot
,
context
.
getConstant
(
obj
.
ref
));
}
if
(
obj
.
storage
!==
undefined
)
{
let
data
=
null
;
if
(
typeof
(
localStorage
)
!==
"undefined"
)
{
let
item
=
localStorage
.
getItem
(
storage
.
key
);
if
(
item
===
null
)
{
if
(
typeof
(
obj
.
storage
.
default
)
!==
"undefined"
)
{
data
=
obj
.
storage
.
default
;
}
}
}
return
new
Invocation
(
component
,
obj
.
slot
,
data
);
}
};
/*ARCS.Invocation.revert = function(obj, context) {
...
...
build/arcs.min.js
View file @
4651939
This diff is collapsed. Click to expand it.
components/console.js
View file @
4651939
...
...
@@ -12,6 +12,8 @@ Console = ARCS.Component.create(
if
(
id
===
undefined
)
{
return
;
}
if
(
typeof
document
===
"undefined"
)
return
;
var
output
=
document
.
getElementById
(
id
);
...
...
src/arcsapp_bundler.js
View file @
4651939
...
...
@@ -6,10 +6,8 @@ const path=require('path');
module
.
exports
=
function
arcsappToJs
(
options
,
loaderContext
,
content
)
{
// content is here our file arcsapp.json
let
descr
=
JSON
.
parse
(
content
);
console
.
log
(
descr
.
context
.
libraries
);
let
code
=
`import ARCS from '../../build/arcs.js';\n`
;
let
libs
=
[];
...
...
src/invocation.js
View file @
4651939
...
...
@@ -37,20 +37,35 @@ let Invocation = function (destination, slot, value) {
* @param context {object} the context in which this invocation takes place.
* @return an invocation
*/
Invocation
.
cast
=
function
(
obj
,
context
)
{
if
(
obj
.
value
!==
undefined
)
{
var
component
=
context
.
getComponent
(
obj
.
destination
);
if
(
component
===
undefined
)
{
Invocation
.
cast
=
function
(
obj
,
context
)
{
let
component
=
context
.
getComponent
(
obj
.
destination
);
if
(
component
===
undefined
)
{
console
.
error
(
"[ARCS] Destination "
,
obj
.
destination
,
" is undefined"
);
}
}
if
(
obj
.
value
!==
undefined
)
{
return
new
Invocation
(
component
,
obj
.
slot
,
obj
.
value
);
}
// this one looks odd, seems there is a failure in the logic.
if
(
obj
.
ref
!==
undefined
)
{
return
new
Invocation
(
co
ntext
.
getComponent
(
obj
.
destination
)
,
obj
.
slot
,
context
.
getConstant
(
obj
.
ref
));
return
new
Invocation
(
co
mponent
,
obj
.
slot
,
context
.
getConstant
(
obj
.
ref
));
}
if
(
obj
.
storage
!==
undefined
)
{
let
data
=
null
;
if
(
typeof
(
localStorage
)
!==
"undefined"
)
{
let
item
=
localStorage
.
getItem
(
storage
.
key
);
if
(
item
===
null
)
{
if
(
typeof
(
obj
.
storage
.
default
)
!==
"undefined"
)
{
data
=
obj
.
storage
.
default
;
}
}
}
return
new
Invocation
(
component
,
obj
.
slot
,
data
);
}
};
/*ARCS.Invocation.revert = function(obj, context) {
...
...
Please
register
or
login
to post a comment