-
Notifications
You must be signed in to change notification settings - Fork 1
/
hello5.js
31 lines (29 loc) · 883 Bytes
/
hello5.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// View with JavaScript value conversion
//
exports.InitializeViewModel = function(context, session) {
return {
firstName: "Jane",
lastName: "Smith",
}
}
exports.View =
{
title: "Hello World 5",
elements:
[
{ control: "edit", binding: "firstName", placeholder: "first name" },
{ control: "edit", binding: "lastName", placeholder: "last name" },
{ control: "text", value: "eval('Hello ' + ({firstName} + ' ' + {lastName}).toUpperCase())" },
{ control: "button", caption: "Submit", binding: "onSubmit", enabled: "eval({firstName} && {lastName})" },
]
}
exports.Commands =
{
onSubmit: function(context, session, viewModel)
{
Synchro.showMessage(context, {
title: "Hello World",
message: "User name: " + viewModel.firstName + " " + viewModel.lastName
});
}
}