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

Commit 4369516

Browse files
committed
fixed typos
1 parent 222dd0f commit 4369516

File tree

2 files changed

+55
-53
lines changed

2 files changed

+55
-53
lines changed

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

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ Here are valuable properties of the `Collection Class` listed.
1212
:::
1313

1414
## `agileInstance`
15-
Agile Instance to which the Collection belongs
15+
16+
The [`agileInstance`](../agile-instance/Introduction.md) to which the Collection belongs.
1617
```ts
17-
MY_STATE.agileInstance(); // Returns a Agile Instance
18+
MY_COLLECTION.agileInstance(); // Returns a Agile Instance
1819
```
19-
Note that it is stored as a function in the Collection, to avoid endless deep classes.
20+
Be aware that the `agileInstance` property is of the type function,
21+
to avoid endless deep classes.
2022

2123

2224

@@ -29,12 +31,17 @@ Note that it is stored as a function in the Collection, to avoid endless deep cl
2931

3032

3133
## `key`
32-
Current key/name of the Collection.
33-
It is used to uniquely identify the Collection.
34-
Besides getting the `key`, we can also assign a new `key` with help of this property.
35-
```ts
36-
MY_COLLECTION.key = "myCoolCollection";
37-
MY_COLLECTION.key; // Returns 'myCoolCollection'
34+
35+
The current `key/name` of the Collection,
36+
which is used to uniquely identify it.
37+
```ts {2}
38+
const MY_COLLECTION = App.createCollection({key: 'jeffKey'});
39+
MY_COLLECTION.key; // Returns 'jeffKey'
40+
```
41+
Besides, accessing the `key`, we can also assign a new `key` through this property.
42+
```ts {1}
43+
MY_STATE.key = "myCoolState";
44+
MY_STATE.key; // Returns 'myCoolState'
3845
```
3946

4047

@@ -48,13 +55,14 @@ MY_COLLECTION.key; // Returns 'myCoolCollection'
4855

4956

5057
## `size`
51-
How many Items are stored in the Collection right now.
58+
59+
Represents how many Items are currently stored in the Collection.
5260
```ts {3}
5361
MY_COLLECTION.collect({id: 1, name: "jeff"});
5462
MY_COLLECTION.collect({id: 5, name: "frank"});
5563
MY_COLLECTION.size; // Returns 2
5664
```
57-
Be aware that placeholder Items doesn't get counted.
65+
Placeholder Items doesn't get counted.
5866

5967

6068

@@ -67,7 +75,8 @@ Be aware that placeholder Items doesn't get counted.
6775

6876

6977
## `data`
70-
All Items of the Collection are stored here.
78+
79+
The `data` object holds all Items of the Collection.
7180
```ts {3}
7281
MY_COLLECTION.collect({id: 1, name: "jeff"});
7382
MY_COLLECTION.collect({id: 5, name: "frank"});
@@ -77,23 +86,14 @@ MY_COLLECTION.data; // Returns (see below)
7786
// 5: Item({id: 5, name: "frank"})
7887
// }
7988
```
80-
We recommend using the `getAllItems` function to get assess to all Items,
81-
```ts {1}
82-
MY_COLLECTION.getAllItems(); // Returns (see below)
83-
// [
84-
// Item({id: 1, name: "jeff"}),
85-
// Item({id: 5, name: "frank"})
86-
// ]
87-
```
88-
or the `default Group`.
89+
We do not recommend accessing the `data` object directly in your code,
90+
as it is intended for internal use and shouldn't be used outside the AgileTs codebase.
91+
The Collection provides all the methods to access the `data` object without further thinking.
92+
For example, to get one specific Item, we should use the `getItem()` method.
8993
```ts {1}
90-
MY_COLLECTION.getGroup(MY_COLLECTION.config.defaultGroupKey).items; // Returns (see below)
91-
// [
92-
// Item({id: 1, name: "jeff"}),
93-
// Item({id: 5, name: "frank"})
94-
// ]
94+
MY_COLLECTION.getItem(1); // Good pattern
95+
MY_COLLECTION.data[1]; // Bad pattern
9596
```
96-
Because the `data` property isn't thought to be used in the outer world.
9797

9898

9999

@@ -106,11 +106,12 @@ Because the `data` property isn't thought to be used in the outer world.
106106

107107

108108
## `isPersisted`
109-
If the State Value got successfully persisted into an external Storage like the [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage).
109+
110+
If the Collection `value` is stored in an external Storage like the [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage).
110111
```ts {1,3}
111-
MY_COLLECTION.isPersisted; // Returns false
112+
MY_COLLECTION.isPersisted; // Returns 'false'
112113
MY_COLLECTION.persist();
113-
MY_COLLECTION.isPersisted; // Returns true (if the persisting was successfull)
114+
MY_COLLECTION.isPersisted; // Returns 'true' if the persist was successful
114115
```
115116

116117

@@ -124,7 +125,8 @@ MY_COLLECTION.isPersisted; // Returns true (if the persisting was successfull)
124125

125126

126127
## `groups`
127-
Here all [Groups](./group/Introduction.md) of the Collection are stored.
128+
129+
All [Groups](./group/Introduction.md) of the Collection are stored in the `groups` property.
128130
```ts {3}
129131
MY_COLLECTION.createGroup("group1", [1, 2, 3]);
130132
MY_COLLECTION.createGroup("group2", [1, 7, 4]);
@@ -134,13 +136,13 @@ MY_COLLECTION.groups; // Returns (see below)
134136
// group2: Group([1, 7, 4])
135137
// }
136138
```
137-
If we want to get access to one specific Group, we should use
138-
```ts
139-
MY_COLLECTION.getGroup("group1");
140-
```
141-
instead of
142-
```ts
143-
MY_COLLECTION.groups["group1"]
139+
We do not recommend accessing the `groups` object directly in your code,
140+
as it is intended for internal use and shouldn't be used outside the AgileTs codebase.
141+
The Collection provides all the methods to access the `groups` object without further thinking.
142+
For example, to get one specific Group, we should use the `getGroup()` method.
143+
```ts {1}
144+
MY_COLLECTION.getGroup(1); // Good pattern
145+
MY_COLLECTION.groups[1]; // Bad pattern
144146
```
145147

146148

@@ -154,22 +156,23 @@ MY_COLLECTION.groups["group1"]
154156

155157

156158
## `selectors`
157-
Here all [Selectors](./selector/Introduction.md) of the Collection are stored.
159+
160+
All [Selectors](./selector/Introduction.md) of the Collection are stored in the `selectors` property.
158161
```ts {3}
159-
MY_COLLECTION.createGroup("selector1", 1);
160-
MY_COLLECTION.createGroup("selector2", 7);
161-
MY_COLLECTION.groups; // Returns (see below)
162+
MY_COLLECTION.createSelector("selector1", 1);
163+
MY_COLLECTION.createSelector("selector2", 7);
164+
MY_COLLECTION.selectors; // Returns (see below)
162165
// {
163166
// selector1: Selector(1),
164167
// selector2: Selector(7)
165168
// }
166169
```
167-
If we want to get access to one specific Selector, we should use
168-
```ts
169-
MY_COLLECTION.getSelector("selector1");
170-
```
171-
instead of
172-
```ts
173-
MY_COLLECTION.selectors["selector1"]
170+
We do not recommend accessing the `selectors` object directly in your code,
171+
as it is intended for internal use and shouldn't be used outside the AgileTs codebase.
172+
The Collection provides all the methods to access the `selectors` object without further thinking.
173+
For example, to get one specific Selector, we should use the `getSelector()` method.
174+
```ts {1}
175+
MY_COLLECTION.getSelector(1); // Good pattern
176+
MY_COLLECTION.selector[1]; // Bad pattern
174177
```
175178

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ to avoid endless deep classes.
3333
## `key`
3434

3535
The current `key/name` of the State,
36-
which is used to uniquely identify the State.
36+
which is used to uniquely identify it.
3737
```ts {2}
3838
const MY_STATE = App.createState(123, {key: 'jeffKey'});
3939
MY_STATE.key; // Returns 'jeffKey'
4040
```
41-
Besides, accessing the `key`,
42-
we can also assign a new `key` through this property to the State.
41+
Besides, accessing the `key`, we can also assign a new `key` through this property.
4342
```ts {1}
4443
MY_STATE.key = "myCoolState";
4544
MY_STATE.key; // Returns 'myCoolState'
@@ -220,7 +219,7 @@ MY_STATE.value; // Returns 'jeff'
220219

221220
## `isPersisted`
222221

223-
If the State `value` is stored into an external Storage like the [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage).
222+
If the State `value` is stored in an external Storage like the [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage).
224223
```ts {1,3}
225224
MY_STATE.isPersisted; // Returns 'false'
226225
MY_STATE.persist();

0 commit comments

Comments
 (0)