-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelloWorld.krl
85 lines (73 loc) · 2.12 KB
/
helloWorld.krl
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
ruleset a169x687 {
meta {
name "Hello World Application"
description <<
myCloud Hello World Application
Copyright 2012 Kynetx, All Rights Reserved
Here is the classic Hello, World application to get you started
building myCloud dashboard applications
>>
author "Ed Orcutt"
logging on
use module a169x625 alias CloudOS
use module a169x664 alias cloudUI
}
global {
thisRID = meta:rid();
}
// ------------------------------------------------------------------------
// Application has been selected to be run on the myCloud dashboard
// Raise event to CloudOS to allocate resources for this application
//
// Test: https://mycloud.kynetx.com/#!/app/a169x687/show
rule appHelloWorld_Selected {
select when web cloudAppSelected
fired {
raise cloudos event appReadyToLoad
with appName = "Hello World"
and appRID = thisRID
and _api = "sky";
}
}
// ------------------------------------------------------------------------
// CloudOS has allocated resources for this application and raised
// the explicit:appLoaded event in the calling Personal Cloud
//
// Insert your application content inside appContentSelector
//
// Raise event cloudos:appReadyToShow to signal CloudOS to display content
rule appHelloWorld_Loaded {
select when explicit appLoaded
pre {
appContentSelector = event:attr("appContentSelector");
appContent = <<
Hello, World!
>>;
}
{
replace_inner(appContentSelector, appContent);
}
fired {
raise cloudos event appReadyToShow
with appRID = thisRID
and _api = "sky";
}
}
// ------------------------------------------------------------------------
// CloudOS has made your application visible
// Hide the spinner
rule appHelloWorld_Shown {
select when explicit appShown
{
cloudUI:hideSpinner();
}
fired {
raise cloudos event cloudAppReady
with appRID = thisRID
and _api = "sky";
}
}
// ------------------------------------------------------------------------
// Beyond here there be dragons :)
// ------------------------------------------------------------------------
}