Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iTasks-SDK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
73
Issues
73
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
iTasks-SDK
Commits
1f95b6f6
Verified
Commit
1f95b6f6
authored
Apr 06, 2019
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back .$! in iTasks.UI.JS.Interface
parent
54983ea2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
34 deletions
+73
-34
Examples/WasmTest.icl
Examples/WasmTest.icl
+1
-3
Libraries/iTasks/UI/JS/Interface.dcl
Libraries/iTasks/UI/JS/Interface.dcl
+26
-11
Libraries/iTasks/UI/JS/Interface.icl
Libraries/iTasks/UI/JS/Interface.icl
+46
-20
No files found.
Examples/WasmTest.icl
View file @
1f95b6f6
...
...
@@ -12,9 +12,6 @@ import iTasks.UI.JS.Interface
import
iTasks
.
UI
.
Prompt
import
iTasks
.
WF
.
Tasks
.
Interaction
// TODO: remove
import
Text
.
GenJSON
Start
w
=
doTasks
task
w
//import iTasks.Internal.SDS
...
...
@@ -37,6 +34,7 @@ task = updateInformation "test"
where
initUI
::
!(
JSObj
())
!*
JSWorld
->
*
JSWorld
initUI
comp
w
#
w
=
(
jsGlobal
"console.log"
.$!
(
1
,
2
,
3
))
w
#
(
jsInitDOMEl
,
w
)
=
jsWrapFun
(
initDOMEl
comp
)
w
#
w
=
(
comp
.#
"initDOMEl"
.=
jsInitDOMEl
)
w
=
w
...
...
Libraries/iTasks/UI/JS/Interface.dcl
View file @
1f95b6f6
...
...
@@ -9,26 +9,41 @@ definition module iTasks.UI.JS.Interface
::
JSObject
a
::
JSFunction
a
class
toJS
a
::
!
a
->
JSVal
a
class
toJS
a
::
!
a
->
JSVal
b
instance
toJS
Int
,
String
jsNull
::
JSVal
a
/**
* Should not be used outside this library. The argument is a reference to a
* DOM element stored somewhere in JavaScript.
*/
referenceToJS
::
!
Int
->
JSVal
a
/**
* Access properties of a JavaScript value.
*/
class
(.#)
infixl
3
attr
::
!(
JSVal
a
)
!
attr
->
JS
Obj
b
class
(.#)
infixl
3
attr
::
!(
JSVal
a
)
!
attr
->
JS
Val
b
instance
.#
String
// object access; may contain dots
instance
.#
Int
// array access
(.=)
infixl
2
::
!(
JSObj
a
)
!(
JSVal
b
)
!*
JSWorld
->
*
JSWorld
(.=)
infixl
1
::
!(
JSObj
a
)
!(
JSVal
b
)
!*
JSWorld
->
*
JSWorld
class
toJSArgs
a
::
!
a
->
[
JSVal
a
]
instance
toJSArgs
Int
,
String
,
()
instance
toJSArgs
(
a
,
b
)
|
toJS
a
&
toJS
b
instance
toJSArgs
(
a
,
b
,
c
)
|
toJS
a
&
toJS
b
&
toJS
c
instance
toJSArgs
(
a
,
b
,
c
,
d
)
|
toJS
a
&
toJS
b
&
toJS
c
&
toJS
d
instance
toJSArgs
(
a
,
b
,
c
,
d
,
e
)
|
toJS
a
&
toJS
b
&
toJS
c
&
toJS
d
&
toJS
e
instance
toJSArgs
(
a
,
b
,
c
,
d
,
e
,
f
)
|
toJS
a
&
toJS
b
&
toJS
c
&
toJS
d
&
toJS
e
&
toJS
f
(.$!)
infixl
2
::
!(
JSFun
a
)
!
b
!*
JSWorld
->
*
JSWorld
|
toJSArgs
b
jsGlobal
::
!
String
->
JSVal
a
jsNull
:==
jsGlobal
"null"
jsThis
:==
jsGlobal
"this"
jsWindow
:==
jsGlobal
"window"
jsDocument
:==
jsGlobal
"document"
/**
* Should not be used outside this library. The argument is a reference to a
* DOM element stored somewhere in JavaScript.
*/
referenceToJS
::
!
Int
->
JSVal
a
/**
* @param A function of the type (a b .. z *JSWorld -> *JSWorld)
...
...
Libraries/iTasks/UI/JS/Interface.icl
View file @
1f95b6f6
implementation
module
iTasks
.
UI
.
JS
.
Interface
import
StdEnv
import
Text
::
*
JSWorld
=
JSWorld
...
...
@@ -9,7 +10,7 @@ import StdEnv
|
JSString
!
String
|
JSRef
!
Int
// a reference to shared_js_values
|
JSCleanRef
!
Int
// a reference to shared_clean_values
|
JS
Null
|
JS
Var
!
String
|
E
.
b
c
:
JSSel
!(
JSVal
b
)
!(
JSVal
c
)
// b[c]
|
E
.
b
:
JSSelPath
!(
JSVal
b
)
!
String
// b.path1.path2...pathn
...
...
@@ -24,7 +25,7 @@ where
JSString
s
->
"'"
+++
s
+++
"'"
// TODO escape
JSRef
i
->
"abc_interpreter.shared_js_values["
+++
toString
i
+++
"]"
JSCleanRef
i
->
"abc_interpreter.apply_to_clean_value("
+++
toString
i
+++
")"
JS
Null
->
"null"
JS
Var
v
->
v
JSSel
obj
attr
->
toString
obj
+++
"["
+++
toString
attr
+++
"]"
JSSelPath
obj
path
->
toString
obj
+++
"."
+++
path
...
...
@@ -33,6 +34,49 @@ js_set :: !(JSVal a) !(JSVal b) !*JSWorld -> *JSWorld
js_set
var
val
w
=
case
eval_js
(
toString
var
+++
"="
+++
toString
val
)
of
True
->
w
instance
toJS
Int
where
toJS
i
=
JSInt
i
instance
toJS
String
where
toJS
s
=
JSString
s
instance
.#
String
where
.#
obj
path
=
JSSelPath
obj
path
instance
.#
Int
where
.#
arr
i
=
JSSel
arr
(
JSInt
i
)
(.=)
infixl
1
::
!(
JSObj
a
)
!(
JSVal
b
)
!*
JSWorld
->
*
JSWorld
(.=)
sel
v
w
=
js_set
sel
v
w
instance
toJSArgs
Int
where
toJSArgs
i
=
[
toJS
i
]
instance
toJSArgs
String
where
toJSArgs
s
=
[
toJS
s
]
instance
toJSArgs
()
where
toJSArgs
_
=
[]
instance
toJSArgs
(
a
,
b
)
|
toJS
a
&
toJS
b
where
toJSArgs
(
a
,
b
)
=
[
toJS
a
,
toJS
b
]
instance
toJSArgs
(
a
,
b
,
c
)
|
toJS
a
&
toJS
b
&
toJS
c
where
toJSArgs
(
a
,
b
,
c
)
=
[
toJS
a
,
toJS
b
,
toJS
c
]
instance
toJSArgs
(
a
,
b
,
c
,
d
)
|
toJS
a
&
toJS
b
&
toJS
c
&
toJS
d
where
toJSArgs
(
a
,
b
,
c
,
d
)
=
[
toJS
a
,
toJS
b
,
toJS
c
,
toJS
d
]
instance
toJSArgs
(
a
,
b
,
c
,
d
,
e
)
|
toJS
a
&
toJS
b
&
toJS
c
&
toJS
d
&
toJS
e
where
toJSArgs
(
a
,
b
,
c
,
d
,
e
)
=
[
toJS
a
,
toJS
b
,
toJS
c
,
toJS
d
,
toJS
e
]
instance
toJSArgs
(
a
,
b
,
c
,
d
,
e
,
f
)
|
toJS
a
&
toJS
b
&
toJS
c
&
toJS
d
&
toJS
e
&
toJS
f
where
toJSArgs
(
a
,
b
,
c
,
d
,
e
,
f
)
=
[
toJS
a
,
toJS
b
,
toJS
c
,
toJS
d
,
toJS
e
,
toJS
f
]
(.$!)
infixl
2
::
!(
JSFun
a
)
!
b
!*
JSWorld
->
*
JSWorld
|
toJSArgs
b
(.$!)
f
args
w
=
case
eval_js
call
of
True
->
w
where
call
=
toString
f
+++
"("
+++
join
","
[
toString
a
\\
a
<-
toJSArgs
args
]+++
")"
jsGlobal
::
!
String
->
JSVal
a
jsGlobal
s
=
JSVar
s
jsWrapFun
::
!
f
!*
JSWorld
->
*(!
JSFun
f
,
!*
JSWorld
)
jsWrapFun
f
world
=
(
cast
(
share
f
),
world
)
referenceToJS
::
!
Int
->
JSVal
a
referenceToJS
ref
=
JSRef
ref
eval_js
::
!
String
->
Bool
eval_js
s
=
code {
instruction
1
...
...
@@ -56,21 +100,3 @@ cast :: !.a -> .b
cast
_
=
code {
no_op
}
instance
toJS
Int
where
toJS
i
=
JSInt
i
instance
toJS
String
where
toJS
s
=
JSString
s
jsNull
::
JSVal
a
jsNull
=
JSNull
referenceToJS
::
!
Int
->
JSVal
a
referenceToJS
ref
=
JSRef
ref
instance
.#
String
where
.#
obj
path
=
JSSelPath
obj
path
instance
.#
Int
where
.#
arr
i
=
JSSel
arr
(
JSInt
i
)
(.=)
infixl
2
::
!(
JSObj
a
)
!(
JSVal
b
)
!*
JSWorld
->
*
JSWorld
(.=)
sel
v
w
=
js_set
sel
v
w
jsWrapFun
::
!
f
!*
JSWorld
->
*(!
JSFun
f
,
!*
JSWorld
)
jsWrapFun
f
world
=
(
cast
(
share
f
),
world
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment