Skip to content

Commit 1104284

Browse files
committed
Update
1 parent 92c80c7 commit 1104284

5 files changed

Lines changed: 75 additions & 2 deletions

File tree

src/SUMMARY.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
- [Overview](./overview.md)
44
- [Iteration capabilities](./overview/iteration.md)
55
- [Event model](./overview/event-model.md)
6-
- [ActionScript 3 relationship](./overview/as3.md)
6+
- [Relation](./overview/relation.md)
7+
- [ActionScript 3](./overview/relation/as3.md)
8+
- [MXML](./overview/relation/mxml.md)
9+
- [React.js](./overview/relation/reactjs.md)
710
- [Scope](./scope.md)
811
- [Definitions](./definitions.md)
912
- [Notational conventions](./notational-conventions.md)

src/overview/relation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Relation
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ActionScript 3 relationship
1+
# ActionScript 3
22

33
ShockScript looks like ActionScript 3. This section describes several details that changed on the language.
44

src/overview/relation/mxml.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# MXML
2+
3+
The MXML language, as part of the Apache Flex framework, is used for describing UI components in an intuitive way. ShockScript uses XML expressions similiar to what is known as ECMAScript for XML (E4X) which implementations may use similiarly to MXML.
4+
5+
Note however that the ShockScript approach is more related to the React.js framework which is often combined with the JSX language extension for TypeScript.
6+
7+
The following demonstrates a basic UI component in Jet Engine:
8+
9+
```
10+
package com.business.components {
11+
import j = jet.**;
12+
13+
/** App bar */
14+
public function AppBar() {
15+
return (
16+
<j:HGroup>
17+
<j:Button click&={trace("clicked!")}>button 1</j:Button>
18+
</j:HGroup>
19+
);
20+
}
21+
}
22+
```
23+
24+
## Event handlers
25+
26+
In MXML, event handlers were expressed as `e="statementList"`. In ShockScript, they are expressed as `e&={statementList}` (note the ampersand **\&**) as a shorthand to `e={function(event){statementList}}`.
27+
28+
> **Note**: Although not demanded as such, as opposed to React.js + DOM, event handlers are conventionally expressed without a `on` prefix, such as `click&={trace("clicked!")}` rather than React.js `onClick={console.log("clicked!")}`. Event parameters are conventionally given the `@event` tag in the documentation comments. Classes continue using the `Event` meta-data, though without needing the `@eventType` tag.

src/overview/relation/reactjs.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# React.js
2+
3+
ShockScript incorporates XML capabilities, and XML expressions allow for implementations to produce anything desired, similiar to JSX. There are certain differences to JSX or React.js.
4+
5+
The following demonstrates a basic XML expression for Jet Engine:
6+
7+
```
8+
import j = jet.**;
9+
10+
<j:HGroup>
11+
<j:Button click&={trace("clicked!")}>button 1</j:Button>
12+
</j:HGroup>
13+
```
14+
15+
## Event handlers
16+
17+
In ShockScript, event handlers are expressed as `e&={statementList}` (note the ampersand **\&**) as a shorthand to `e={function(event){statementList}}`. Furthermore, event handlers are conventionally expressed without an `on` prefix (for instance, `click` instead of `onClick`), and they are documented with the `@event` tag.
18+
19+
## Prefixes
20+
21+
ShockScript allows for `<q:N>`, whose name resolution equals `q::N`. Dots may be used for entities other than namespaces, as in:
22+
23+
```
24+
<com.business.components.AppBar/>
25+
```
26+
27+
For brevity, you do either:
28+
29+
```
30+
import bComps = com.business.components.**
31+
32+
<bComps:AppBar/>
33+
```
34+
35+
or:
36+
37+
```
38+
import com.business.components.*
39+
40+
<AppBar/>
41+
```

0 commit comments

Comments
 (0)