@@ -15,7 +15,7 @@ Here all methods of the `Agile Instance` are described.
15
15
## ` createState() `
16
16
17
17
Creates a new [ State] ( ../state/Introduction.md ) ,
18
- which gets automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
18
+ which is automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
19
19
``` ts
20
20
const State = App .createState (' jeff' , {
21
21
key: ' dummyState' ,
@@ -30,6 +30,10 @@ const State = App.createState('jeff', {
30
30
| ` config ` | [ StateConfigInterface] ( ../../../../Interfaces.md#stateconfig ) | {} | Configuration | No |
31
31
32
32
### 📄 Return
33
+
34
+ ``` ts
35
+ State
36
+ ```
33
37
Returns a fresh [ State] ( ../state/Introduction.md ) .
34
38
35
39
@@ -45,7 +49,7 @@ Returns a fresh [State](../state/Introduction.md).
45
49
## ` createCollection() `
46
50
47
51
Creates a new [ Collection] ( ../collection/Introduction.md ) ,
48
- which gets automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
52
+ which is automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
49
53
``` ts {1-4,8-13}
50
54
const Collection = App .createCollection ({
51
55
key: ' dummyCollection' ,
@@ -70,6 +74,10 @@ const Collection2 = App.createCollection((collection) => ({
70
74
71
75
72
76
### 📄 Return
77
+
78
+ ``` ts
79
+ Collection
80
+ ```
73
81
Returns a fresh [ Collection] ( ../collection/Introduction.md ) .
74
82
75
83
@@ -85,7 +93,7 @@ Returns a fresh [Collection](../collection/Introduction.md).
85
93
## ` createComputed() `
86
94
87
95
Creates a new [ Computed] ( ../computed/Introduction.md ) ,
88
- which gets automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
96
+ which is automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
89
97
``` ts {1,5-7}
90
98
const Computed = App .createComputed (() => {/* Computed Method */ }, [/* hard coded deps */ ])
91
99
@@ -105,6 +113,10 @@ const ComputedWithConfig = App.createComputed(() => {/* Computed Method */}, {
105
113
| ` deps ` | Array<Observer \| State \| Event \| Group\> | [ ] | Dependencies of Computed | No |
106
114
107
115
### 📄 Return
116
+
117
+ ``` ts
118
+ Computed
119
+ ```
108
120
Returns a fresh [ Computed] ( ../computed/Introduction.md ) .
109
121
110
122
@@ -120,7 +132,7 @@ Returns a fresh [Computed](../computed/Introduction.md).
120
132
## ` createEvent() `
121
133
122
134
Creates a new [ Event] ( ../event/Introduction.md ) ,
123
- which gets automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
135
+ which is automatically bound to the [ Agile Instance] ( ../agile-instance/Introduction.md ) it was created from.
124
136
``` ts
125
137
const Event = App .createEvent ({
126
138
key: ' dummyEvent' ,
@@ -135,6 +147,10 @@ const Event = App.createEvent({
135
147
136
148
137
149
### 📄 Return
150
+
151
+ ``` ts
152
+ Events
153
+ ```
138
154
Returns a fresh [ Event] ( ../event/Introduction.md ) .
139
155
140
156
@@ -149,10 +165,18 @@ Returns a fresh [Event](../event/Introduction.md).
149
165
150
166
## ` integrate() `
151
167
152
- Allows us to integrate AgileTs into nearly any [ Framework/Integration] ( ../integration/Introduction.md ) .
153
- For instance in case of [ React] ( https://reactjs.org/ ) , AgileTs offers a [ React Integration] ( ../integration/Introduction.md ) ,
154
- which allows us to integrate it into AgileTs.
155
- ``` ts {29}
168
+ With ` integrate() ` we can integrate any Framework [ Integration] ( ../integration/Introduction.md ) into AgileTs.
169
+ An Integration simply tells AgileTs, how it has to mutate a specific Component,
170
+ whenever a State changes. In order binding States to Components and thus be reactive,
171
+ each Framework using AgileTs needs an Integration for AgileTs.
172
+ For instance to use AgileTs in a [ React] ( https://reactjs.org/ ) environment,
173
+ we have to integrate a React Integration into AgileTs.
174
+ ``` ts
175
+ App .integrate (reactIntegration );
176
+ ```
177
+ To give you some reference, how such an Integration might look like.
178
+ Here is the React Integration:
179
+ ``` ts
156
180
const reactIntegration = new Integration <typeof React , AgileReactComponent >({
157
181
key: ' react' ,
158
182
frameworkInstance: React ,
@@ -177,11 +201,7 @@ const reactIntegration = new Integration<typeof React, AgileReactComponent>({
177
201
});
178
202
179
203
// Each initialIntegraion gets integrated into AgileTs automatically during initialation
180
- // Note: Only useful if you create your own integration
181
204
Agile .initialIntegrations .push (reactIntegration );
182
-
183
- // Or we integrate it manually (mostly the case if the auto integration doesn't work)
184
- App .integrate (reactIntegration );
185
205
```
186
206
187
207
### 📭 Props
@@ -191,6 +211,10 @@ App.integrate(reactIntegration);
191
211
| ` integration ` | [ Integration] ( ../integration/Introduction.md ) | undefined | Integration that gets registered/integrated into AgileTs | Yes |
192
212
193
213
### 📄 Return
214
+
215
+ ``` ts
216
+ Agile
217
+ ```
194
218
Returns the [ Agile Instance] ( ./Introduction.md ) it was called from
195
219
196
220
@@ -204,10 +228,14 @@ Returns the [Agile Instance](./Introduction.md) it was called from
204
228
205
229
206
230
## ` hasIntegration() `
231
+
207
232
Checks if AgileTs has any registered [ Integration] ( ../integration/Introduction.md ) .
208
233
209
234
### 📄 Return
210
- ` boolean `
235
+
236
+ ``` ts
237
+ boolean
238
+ ```
211
239
212
240
213
241
@@ -221,7 +249,8 @@ Checks if AgileTs has any registered [Integration](../integration/Introduction.m
221
249
222
250
## ` createStorage() `
223
251
224
- Creates a new [ Storage] ( ../storage/Introduction.md ) .
252
+ Creates a new [ Storage] ( ../storage/Introduction.md ) Interface for AgileTs,
253
+ which allows AgileTs to work with the Storage, the Interface represents.
225
254
``` ts
226
255
const Storage = App .createStorage ({
227
256
key: ' dummyStorage' ,
@@ -232,7 +261,8 @@ const Storage = App.createStorage({
232
261
}
233
262
})
234
263
```
235
- To register a newly created Storage, we use the [ registerStorage] ( #registerstorage ) function.
264
+ Such Storage can be registered in AgileTs with the [ registerStorage()] ( #registerstorage ) method.
265
+ After a successful registration we can store/[ persist] ( ../state/Methods.md#persist ) any State in the Storage.
236
266
237
267
### 📭 Props
238
268
@@ -242,6 +272,10 @@ To register a newly created Storage, we use the [registerStorage](#registerstora
242
272
| ` methods ` | [ StorageMethodsInterface] ( ../../../../Interfaces.md#storagemethods ) | {} | Methods with which the Storage get mutated | Yes |
243
273
244
274
### 📄 Return
275
+
276
+ ``` ts
277
+ Storage
278
+ ```
245
279
Returns a fresh [ Storage] ( ../storage/Introduction.md ) .
246
280
247
281
@@ -256,9 +290,10 @@ Returns a fresh [Storage](../storage/Introduction.md).
256
290
257
291
## ` registerStorage() `
258
292
259
- Adds a new [ Storage] ( ../storage/Introduction.md ) to AgileTs,
260
- which later can store persisted Instances (` .persist() ` ).
293
+ Registers a new [ Storage] ( ../storage/Introduction.md ) Interface to AgileTs,
294
+ which later can store persisted Instances ([ ` .persist() ` ] ( ../state/Methods.md ) ).
261
295
The [ Local Storage] ( https://developer.mozilla.org/de/docs/Web/API/Window/localStorage ) is registered by default.
296
+ Below you can see how the localStorage is registered internally.
262
297
``` ts {13}
263
298
// Here we create our Storage
264
299
const _localStorage = new Storage ({
@@ -282,6 +317,10 @@ App.register(_localStorage, { default: true });
282
317
| ` integration ` | [ Integration] ( ../integration/Introduction.md ) | undefined | Integration that gets registered/integrated into AgileTs | Yes |
283
318
284
319
### 📄 Return
320
+
321
+ ``` ts
322
+ Agile
323
+ ```
285
324
Returns the [ Agile Instance] ( ./Introduction.md ) it was called from
286
325
287
326
@@ -295,8 +334,12 @@ Returns the [Agile Instance](./Introduction.md) it was called from
295
334
296
335
297
336
## ` hasStorage() `
337
+
298
338
Checks if AgileTs has any registered [ Storage] ( ../storage/Introduction.md ) .
299
339
If AgileTs couldn't find any Storage, we aren't able to use the ` .persist() ` functionality in any Agile Sub Instance.
300
340
301
341
### 📄 Return
302
- ` boolean `
342
+
343
+ ``` ts
344
+ boolean
345
+ ```
0 commit comments