Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 38cd6d0

Browse files
authored
Merge pull request #22 from agile-ts/develop
Develop
2 parents 0481e93 + fe8b0e0 commit 38cd6d0

File tree

8 files changed

+220
-92
lines changed

8 files changed

+220
-92
lines changed

docs/packages/core/Installation.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ The `core` Package can be installed over [npm](https://www.npmjs.com/).
99

1010
```bash npm2yarn
1111
npm install @agile-ts/core
12-
```
12+
```
13+
If you prefer following a Quick Start 🚀
14+
- [React](../../quick_start/React.md)
15+
- [Vue](../../quick_start/Vue.md)

docs/packages/core/Introduction.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ A Computed is an extension of the State Class, it does auto compute its value de
6363
```
6464

6565
### 🚌 [Event](./features/event/Introduction.md)
66+
Events are handy for emitting UI updates and passing data with them.
6667
```ts
6768
const MY_EVENT = App.createEvent();
68-
MY_EVENT.on(() => {console.log("hello there")}); // Print 'hello there' if Event gets triggered
69-
MY_EVENT.trigger(); // Trigger Event
69+
MY_EVENT.on((data) => {console.log("hello there " + data.name)}); // Print 'hello there jeff' if Event gets triggered
70+
MY_EVENT.trigger({name: "jeff"}); // Trigger Event
7071
```
7172

7273
## 🚀 Quick Links
74+
- [Installation](./Installation.md)
75+
- [Agile-Instance](./features/agile-instance/Introduction.md)
7376
- [State](./features/state/Introduction.md)
7477
- [Collection](./features/collection/Introduction.md)
7578
- [Computed](./features/computed/Introduction.md)

docs/packages/core/features/agile-instance/Properties.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ Here useful properties of the `Agile Instance` are described.
1313

1414
## `logger`
1515

16-
The logger gets used to Log warnings, errors, .. in AgileTs, but of course we can
17-
use it in our Application too.
16+
The `logger` is a static property of the `Agile Class`.
17+
It is an Instance of a handy Class that gets used to Log something in the console, like warnings, errors.
18+
Feel free to use the Agile Logger in your Application for logging too,
19+
it is pretty handy.
1820
```ts
1921
Agile.logger.warn("This is a Warning");
2022
Agile.logger.log("This is a normal Log");

docs/packages/core/features/collection/Properties.md

+108-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,113 @@ sidebar_label: Properties
55
slug: /core/collection/properties
66
---
77

8-
:::warning
8+
:::info
99

10-
WIP docs!
10+
Here useful properties of the `State` are listed.
11+
12+
:::
13+
14+
## `agileInstance`
15+
Returns the Agile Instance to which the Collection belongs.
16+
Be aware that it gets in function shape returned.
17+
```ts
18+
MY_STATE.agileInstance(); // Returns a Agile Instance
19+
```
20+
The reason for that is to avoid endless deep classes.
21+
22+
## `key`
23+
Returns the current Key/Name of the Collection.
24+
A Key is used to uniquely identify the Collection.
25+
Besides getting the key, we can also assign a new Key with this property.
26+
```ts
27+
MY_COLLECTION.key = "myCoolCollection";
28+
MY_COLLECTION.key; // Returns 'myCoolCollection'
29+
```
30+
31+
## `size`
32+
Returns the current size of the Collection,
33+
so how many Items are stored in the Collection
34+
to this point in time.
35+
```ts {3}
36+
MY_COLLECTION.collect({id: 1, name: "jeff"});
37+
MY_COLLECTION.collect({id: 5, name: "frank"});
38+
MY_COLLECTION.size; // Returns 2
39+
```
40+
41+
## `data`
42+
Here all Items of the Collection are stored.
43+
```ts {3}
44+
MY_COLLECTION.collect({id: 1, name: "jeff"});
45+
MY_COLLECTION.collect({id: 5, name: "frank"});
46+
MY_COLLECTION.data; // Returns (see below)
47+
// {
48+
// 1: Item({id: 1, name: "jeff"}),
49+
// 5: Item({id: 5, name: "frank"})
50+
// }
51+
```
52+
We recommend using the `getAllItems` function to get assess to all Items,
53+
```ts {1}
54+
MY_COLLECTION.getAllItems(); // Returns (see below)
55+
// [
56+
// Item({id: 1, name: "jeff"}),
57+
// Item({id: 5, name: "frank"})
58+
// ]
59+
```
60+
or the `default Group`,
61+
```ts {1}
62+
MY_COLLECTION.getGroup(MY_COLLECTION.config.defaultGroupKey).items; // Returns (see below)
63+
// [
64+
// Item({id: 1, name: "jeff"}),
65+
// Item({id: 5, name: "frank"})
66+
// ]
67+
```
68+
because the `data` property should only be used internal!
69+
70+
## `isPersisted`
71+
If the Collection Value got persisted into a Storage like the Local Storage.
72+
```ts {1,3}
73+
MY_COLLECTION.isPersisted; // Returns false
74+
MY_COLLECTION.persist();
75+
MY_COLLECTION.isPersisted; // Returns true (if the persisting was successfull)
76+
```
77+
78+
## `groups`
79+
Here all [Groups](./group/Introduction.md) of the Collection are stored.
80+
```ts {3}
81+
MY_COLLECTION.createGroup("group1", [1, 2, 3]);
82+
MY_COLLECTION.createGroup("group2", [1, 7, 4]);
83+
MY_COLLECTION.groups; // Returns (see below)
84+
// {
85+
// group1: Group([1, 2, 3]),
86+
// group2: Group([1, 7, 4])
87+
// }
88+
```
89+
If you want to get a specific Group, please use
90+
```ts
91+
MY_COLLECTION.getGroup("group1");
92+
```
93+
instead of
94+
```ts
95+
MY_COLLECTION.groups["group1"]
96+
```
97+
98+
## `selectors`
99+
Here all [Selectors](./selector/Introduction.md) of the Collection are stored.
100+
```ts {3}
101+
MY_COLLECTION.createGroup("selector1", 1);
102+
MY_COLLECTION.createGroup("selector2", 7);
103+
MY_COLLECTION.groups; // Returns (see below)
104+
// {
105+
// selector1: Selector(1),
106+
// selector2: Selector(7)
107+
// }
108+
```
109+
If you want to get a specific Selector, please use
110+
```ts
111+
MY_COLLECTION.getSelector("selector1");
112+
```
113+
instead of
114+
```ts
115+
MY_COLLECTION.selectors["selector1"]
116+
```
11117

12-
:::

docs/packages/core/features/state/Introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ MY_STATE.undo().set("Hello Hell").watch(() => {}).reset().invert().persist().typ
3737
```
3838

3939
### 🔨 Usage
40-
We might use a State, if we want to remember the theme of our application or the logged in userId.
40+
We might use a State, if we want to remember the theme of our application, or the userId of the logged-in User.
4141
```ts
4242
const THEME_TYPE = App.createState("dark");
4343
// <- toggled theme switch

0 commit comments

Comments
 (0)