-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsandbox.js
48 lines (42 loc) · 1.24 KB
/
sandbox.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Sandbox page
//
exports.View =
{
title: "Sandbox",
elements:
[
{ control: "border", border: "Blue", borderthickness: "5", contents: [
{ control: "scrollview", orientation: "Horizontal", height: 150, width: 150, contents: [
{ control: "image", height: 300, width: 300, resource: "{image}" },
] },
] },
{ control: "image", height: 150, width: 150, resource: "{image}" },
{ control: "button", caption: "Switch images", binding: "switchImages" },
{ control: "text", value: "Container: {container}" },
]
}
exports.InitializeViewModel = function(context, session)
{
var viewModel =
{
container: Synchro.getConfig(context, "container")
}
viewModel.image = switchImages(contect, session, viewModel);
return viewModel;
}
exports.Commands =
{
switchImages: function(context, session, viewModel)
{
var profileImage = Synchro.getResourceUrl(context, "cloud_system_256.png");
var userImage = Synchro.getResourceUrl(context, "user.png");
if (viewModel.image == userImage)
{
viewModel.image = profileImage;
}
else
{
viewModel.image = userImage;
}
},
}