Skip to content

Commit 2cf6885

Browse files
committed
oh my god it works
1 parent 7928cb0 commit 2cf6885

7 files changed

Lines changed: 178 additions & 26 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ SPlsWork/
1515
*.sm2
1616
*.smft
1717
*.zip
18+
*.smw
1819

1920
# VT Pro-e
2021
*.vtz

contracts/General.cce

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"Errors": [],
3+
"id": "_pv76zc333",
4+
"name": "General",
5+
"description": "General",
6+
"company": "Abt",
7+
"client": "",
8+
"author": "Danny",
9+
"version": "1.0.0.0",
10+
"schemaVersion": 1,
11+
"subContractLinks": [],
12+
"subContracts": [],
13+
"specifications": [
14+
{
15+
"Errors": [],
16+
"parentId": "_pv76zc333",
17+
"id": "_8fgfkc3zy",
18+
"componentId": "_r1bcd5wi3",
19+
"instanceName": "Room",
20+
"numberOfInstances": 1
21+
}
22+
],
23+
"components": [
24+
{
25+
"Errors": [],
26+
"parentId": "_pv76zc333",
27+
"id": "_r1bcd5wi3",
28+
"name": "Room",
29+
"description": "Room properties",
30+
"commands": [
31+
{
32+
"Errors": [],
33+
"name": "Power_On_Fb",
34+
"siblingId": "_frk4rlut6",
35+
"dataType": 1,
36+
"notes": "",
37+
"id": "_24j6u53bd",
38+
"parentId": "_r1bcd5wi3",
39+
"attributeType": 0
40+
},
41+
{
42+
"Errors": [],
43+
"name": "Power_Off_Fb",
44+
"siblingId": "_f3bnz29wa",
45+
"dataType": 1,
46+
"notes": "",
47+
"id": "_l9ggyhvxt",
48+
"parentId": "_r1bcd5wi3",
49+
"attributeType": 0
50+
},
51+
{
52+
"Errors": [],
53+
"name": "Mode_Fb",
54+
"siblingId": "_1kz3z4igb",
55+
"dataType": 2,
56+
"notes": "",
57+
"id": "_3axc7yul9",
58+
"parentId": "_r1bcd5wi3",
59+
"attributeType": 0
60+
},
61+
{
62+
"Errors": [],
63+
"name": "Name_Fb",
64+
"siblingId": "_1926ms4xt",
65+
"dataType": 3,
66+
"notes": "",
67+
"id": "_u9vanguvr",
68+
"parentId": "_r1bcd5wi3",
69+
"attributeType": 0
70+
}
71+
],
72+
"feedbacks": [
73+
{
74+
"Errors": [],
75+
"name": "Power_On",
76+
"siblingId": "_24j6u53bd",
77+
"dataType": 1,
78+
"notes": "",
79+
"id": "_frk4rlut6",
80+
"parentId": "_r1bcd5wi3",
81+
"attributeType": 1
82+
},
83+
{
84+
"Errors": [],
85+
"name": "Power_Off",
86+
"siblingId": "_l9ggyhvxt",
87+
"dataType": 1,
88+
"notes": "",
89+
"id": "_f3bnz29wa",
90+
"parentId": "_r1bcd5wi3",
91+
"attributeType": 1
92+
},
93+
{
94+
"Errors": [],
95+
"name": "Mode",
96+
"siblingId": "_3axc7yul9",
97+
"dataType": 2,
98+
"notes": "",
99+
"id": "_1kz3z4igb",
100+
"parentId": "_r1bcd5wi3",
101+
"attributeType": 1
102+
},
103+
{
104+
"Errors": [],
105+
"name": "",
106+
"siblingId": "_u9vanguvr",
107+
"dataType": 0,
108+
"notes": "",
109+
"id": "_1926ms4xt",
110+
"parentId": "_r1bcd5wi3",
111+
"attributeType": 1
112+
}
113+
],
114+
"specifications": []
115+
}
116+
],
117+
"allComponentsForAllContracts": []
118+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "html5-tutorial",
33
"version": "1.0.0",
44
"description": "Walks through building different HTML5 layouts for AV systems",
5-
"main": "app.js",
5+
"main": "bundle.js",
66
"scripts": {
77
"build": "webpack",
88
"archive": "ch5-cli archive -p project -d dist -o archive",

src/app.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
document.addEventListener('DOMContentLoaded', function () {
2-
let content = document.querySelector('.content');
1+
import {
2+
publishEvent,
3+
subscribeState,
4+
bridgeReceiveIntegerFromNative,
5+
bridgeReceiveBooleanFromNative,
6+
bridgeReceiveStringFromNative,
7+
bridgeReceiveObjectFromNative
8+
} from '@crestron/ch5-crcomlib/build_bundles/cjs/cr-com-lib';
39

4-
let msg = document.createElement('h2');
5-
msg.innerText = '(batteries included)';
6-
console.log(msg);
7-
8-
content.appendChild(msg);
9-
});
10+
window.bridgeReceiveIntegerFromNative = bridgeReceiveIntegerFromNative;
11+
window.bridgeReceiveBooleanFromNative = bridgeReceiveBooleanFromNative;
12+
window.bridgeReceiveStringFromNative = bridgeReceiveStringFromNative;
13+
window.bridgeReceiveObjectFromNative = bridgeReceiveObjectFromNative;

src/index.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<title>Document</title>
99
<link rel="stylesheet" href="style.css">
10-
<script src="app.js"></script>
1110
</head>
1211

1312
<body>
1413
<div class="content">
15-
<h1>My HTML5 Template</h1>
16-
</div>
14+
<h1 data-ch5-textcontent="Room.Name_Fb">Room Name</h1>
15+
<div class="btn-group">
16+
<ch5-button label="Power On" sendEventOnClick="Room.Power_On" receiveStateSelected="Room.Power_On_Fb">
17+
</ch5-button>
18+
<ch5-button label="Power Off" sendEventOnClick="Room.Power_Off" receiveStateSelected="Room.Power_Off_Fb">
19+
</ch5-button>
20+
</div>
21+
<script src="bundle.js"></script>
1722
</body>
1823

1924
</html>

src/style.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
body {
99
display: flex;
10+
flex-direction: column;
1011
align-items: center;
1112
justify-content: center;
1213
height: 100vh;
@@ -19,6 +20,8 @@ body {
1920
h1 {
2021
font-family: 'Muli', sans-serif;
2122
font-size: 4rem;
23+
margin: 1rem;
24+
text-align: center;
2225
}
2326

2427
h2 {
@@ -29,3 +32,24 @@ h2 {
2932
text-align: center;
3033
color: rebeccapurple;
3134
}
35+
.btn-group {
36+
display: flex;
37+
flex-direction: row;
38+
}
39+
40+
.ch5-button .cb-btn {
41+
background: linear-gradient(#4488ff, #2244ee);
42+
border: solid 2px #002288;
43+
color: #fafafa;
44+
border-radius: 1.5rem;
45+
padding: 2rem;
46+
margin: 0.5rem;
47+
font-size: 2rem;
48+
}
49+
50+
.ch5-button--selected .cb-btn {
51+
background: linear-gradient(180deg, #cc6600, #ff8800);
52+
border: solid 2px #111111;
53+
color: #111111;
54+
outline: none;
55+
}

webpack.config.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ module.exports = function (env) {
1818
filename: 'bundle.js',
1919
path: path.resolve(__dirname, env.target, 'dist')
2020
},
21-
plugins: [
22-
new CopyPlugin({
23-
patterns: [
24-
{
25-
from: env.source + '/assets',
26-
to: 'assets/'
27-
},
28-
{
29-
from: env.source + '/*.(html|css)',
30-
to: '[name][ext]'
31-
}
32-
]
33-
})
34-
]
21+
// plugins: [
22+
// new CopyPlugin({
23+
// patterns: [
24+
// {
25+
// from: env.source + '/assets',
26+
// to: 'assets/'
27+
// },
28+
// {
29+
// from: env.source + '/*.(html|css)',
30+
// to: '[name][ext]'
31+
// }
32+
// ]
33+
// })
34+
// ]
3535
};
3636
};

0 commit comments

Comments
 (0)