Skip to content

Commit bce31c3

Browse files
committed
fixed a minor error
1 parent cc5f8d5 commit bce31c3

File tree

1 file changed

+44
-48
lines changed

1 file changed

+44
-48
lines changed

example/logic.js

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,58 @@
1-
ojs(async e => {
1+
ojs(async (e) => {
2+
fetchContext("rootCxt", "Root");
3+
putContext("blogCxt", "Blog.Context");
24

3-
fetchContext("rootCxt", "Root");
4-
putContext("blogCxt", "Blog.Context");
5+
req("App");
56

6-
req("App");
7+
const bc = context("blogCxt");
78

8-
const bc = context("blogCxt");
9+
let blog = [];
910

10-
let blog = [];
11-
12-
13-
for(let i = 5; i < 20; i++){
14-
blog.push({
15-
text: `Blog Heading ${i}`,
16-
subtitle: `Blog Subtitle ${i}`,
17-
description: `Blog Description for This blog with random number ${(new Date()).getTime()} and ID ${i}`,
18-
link: `#`,
19-
id: i
20-
})
21-
}
22-
23-
blog = state(blog);
24-
25-
bc.put("counter", state(0));
26-
bc.put("blogs", blog);
11+
for (let i = 5; i < 20; i++) {
12+
blog.push({
13+
text: `Blog Heading ${i}`,
14+
subtitle: `Blog Subtitle ${i}`,
15+
description: `Blog Description for This blog with random number ${new Date().getTime()} and ID ${i}`,
16+
link: `#`,
17+
id: i,
18+
});
19+
}
2720

28-
bc.number = state(0);
21+
blog = state(blog);
2922

30-
let rc = context("rootCxt");
31-
rc.domRoot = h.dom.querySelector("#root");
23+
bc.put("counter", state(0));
24+
bc.put("blogs", blog);
3225

33-
h.App( { parent: rc.domRoot })
26+
bc.number = state(0);
3427

35-
setInterval(() => {
36-
let blog = [];
28+
let rc = context("rootCxt");
29+
rc.domRoot = h.dom.querySelector("#root");
3730

31+
h.App({ parent: rc.domRoot });
3832

39-
for(let i = 5; i < 20; i++){
40-
let random = Math.floor(Math.random() * 100) ;
41-
42-
blog.push({
43-
text: `Blog Heading ${i * random}`,
44-
subtitle: `Blog Subtitle ${i * random}`,
45-
description: `Blog Description for This blog with random number ${(new Date()).getTime()} and ID ${i * random}`,
46-
link: `#`,
47-
id: i * random
48-
})
49-
}
50-
51-
// bc.blogs.value = blog;
52-
bc.counter.value++;
33+
setInterval(() => {
34+
let blog = [];
5335

54-
}, 1000);
36+
for (let i = 5; i < 20; i++) {
37+
let random = Math.floor(Math.random() * 100);
38+
39+
blog.push({
40+
text: `Blog Heading ${i * random}`,
41+
subtitle: `Blog Subtitle ${i * random}`,
42+
description: `Blog Description for This blog with random number ${new Date().getTime()} and ID ${
43+
i * random
44+
}`,
45+
link: `#`,
46+
id: i * random,
47+
});
48+
}
5549

56-
setInterval(() => {
57-
bc.number.value++;
58-
broker.send('numberChanged')
59-
}, 500);
50+
// bc.blogs.value = blog;
51+
bc.counter.value++;
52+
}, 1000);
6053

54+
setInterval(() => {
55+
bc.number.value++;
56+
broker.send("numberChanged");
57+
}, 500);
6158
});
62-

0 commit comments

Comments
 (0)