|
1 | | -ojs(async e => { |
| 1 | +ojs(async (e) => { |
| 2 | + fetchContext("rootCxt", "Root"); |
| 3 | + putContext("blogCxt", "Blog.Context"); |
2 | 4 |
|
3 | | - fetchContext("rootCxt", "Root"); |
4 | | - putContext("blogCxt", "Blog.Context"); |
| 5 | + req("App"); |
5 | 6 |
|
6 | | - req("App"); |
| 7 | + const bc = context("blogCxt"); |
7 | 8 |
|
8 | | - const bc = context("blogCxt"); |
| 9 | + let blog = []; |
9 | 10 |
|
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 | + } |
27 | 20 |
|
28 | | - bc.number = state(0); |
| 21 | + blog = state(blog); |
29 | 22 |
|
30 | | - let rc = context("rootCxt"); |
31 | | - rc.domRoot = h.dom.querySelector("#root"); |
| 23 | + bc.put("counter", state(0)); |
| 24 | + bc.put("blogs", blog); |
32 | 25 |
|
33 | | - h.App( { parent: rc.domRoot }) |
| 26 | + bc.number = state(0); |
34 | 27 |
|
35 | | - setInterval(() => { |
36 | | - let blog = []; |
| 28 | + let rc = context("rootCxt"); |
| 29 | + rc.domRoot = h.dom.querySelector("#root"); |
37 | 30 |
|
| 31 | + h.App({ parent: rc.domRoot }); |
38 | 32 |
|
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 = []; |
53 | 35 |
|
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 | + } |
55 | 49 |
|
56 | | - setInterval(() => { |
57 | | - bc.number.value++; |
58 | | - broker.send('numberChanged') |
59 | | - }, 500); |
| 50 | + // bc.blogs.value = blog; |
| 51 | + bc.counter.value++; |
| 52 | + }, 1000); |
60 | 53 |
|
| 54 | + setInterval(() => { |
| 55 | + bc.number.value++; |
| 56 | + broker.send("numberChanged"); |
| 57 | + }, 500); |
61 | 58 | }); |
62 | | - |
0 commit comments