@@ -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
+ Event
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, howto mutate a particular Component,
170
+ whenever a State changes. To bind States to Components and thus be reactive,
171
+ any Framework using AgileTs needs an Integration for AgileTs.
172
+ For example, to use AgileTs in a [ React] ( https://reactjs.org/ ) environment,
173
+ we have to register a React Integration to 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,9 @@ 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
+ that allows AgileTs to work with the Storage that the Interface represents.
254
+ The Interface allows AgileTs to permanently store States in the Storage.
225
255
``` ts
226
256
const Storage = App .createStorage ({
227
257
key: ' dummyStorage' ,
@@ -232,7 +262,8 @@ const Storage = App.createStorage({
232
262
}
233
263
})
234
264
```
235
- To register a newly created Storage, we use the [ registerStorage] ( #registerstorage ) function.
265
+ Such Storage can be registered in AgileTs with the [ registerStorage()] ( #registerstorage ) method.
266
+ After a successful registration we can store/[ persist] ( ../state/Methods.md#persist ) any State in the Storage.
236
267
237
268
### 📭 Props
238
269
@@ -242,6 +273,10 @@ To register a newly created Storage, we use the [registerStorage](#registerstora
242
273
| ` methods ` | [ StorageMethodsInterface] ( ../../../../Interfaces.md#storagemethods ) | {} | Methods with which the Storage get mutated | Yes |
243
274
244
275
### 📄 Return
276
+
277
+ ``` ts
278
+ Storage
279
+ ```
245
280
Returns a fresh [ Storage] ( ../storage/Introduction.md ) .
246
281
247
282
@@ -256,12 +291,13 @@ Returns a fresh [Storage](../storage/Introduction.md).
256
291
257
292
## ` registerStorage() `
258
293
259
- Adds a new [ Storage] ( ../storage/Introduction.md ) to AgileTs,
260
- which later can store persisted Instances (` .persist() ` ).
261
- The [ Local Storage] ( https://developer.mozilla.org/de/docs/Web/API/Window/localStorage ) is registered by default.
294
+ Registers a new [ Storage] ( ../storage/Introduction.md ) Interface to AgileTs.
295
+ It is used to permanently store persisted Instances ([ ` .persist() ` ] ( ../state/Methods.md ) ) in the Storage that the Interface represents.
296
+ By default, the [ Local Storage] ( https://developer.mozilla.org/de/docs/Web/API/Window/localStorage ) is registered.
297
+ Below you can see how the ` localStorage ` is registered internally.
262
298
``` ts {13}
263
- // Here we create our Storage
264
- const _localStorage = new Storage ({
299
+ // create localStorage Interface with help of the Agile Storage
300
+ const _localStorage = App . createStorage ({
265
301
key: ' localStorage' ,
266
302
async: false ,
267
303
methods: {
@@ -271,7 +307,7 @@ const _localStorage = new Storage({
271
307
},
272
308
});
273
309
274
- // Here we register our Storage
310
+ // Register Storage to current Agile Instance (App)
275
311
App .register (_localStorage , { default: true });
276
312
```
277
313
@@ -282,6 +318,10 @@ App.register(_localStorage, { default: true });
282
318
| ` integration ` | [ Integration] ( ../integration/Introduction.md ) | undefined | Integration that gets registered/integrated into AgileTs | Yes |
283
319
284
320
### 📄 Return
321
+
322
+ ``` ts
323
+ Agile
324
+ ```
285
325
Returns the [ Agile Instance] ( ./Introduction.md ) it was called from
286
326
287
327
@@ -295,8 +335,12 @@ Returns the [Agile Instance](./Introduction.md) it was called from
295
335
296
336
297
337
## ` hasStorage() `
338
+
298
339
Checks if AgileTs has any registered [ Storage] ( ../storage/Introduction.md ) .
299
- If AgileTs couldn't find any Storage, we aren't able to use the ` .persist() ` functionality in any Agile Sub Instance .
340
+ If AgileTs couldn't find any Storage, the ` .persist() ` method can not store any value permanently .
300
341
301
342
### 📄 Return
302
- ` boolean `
343
+
344
+ ``` ts
345
+ boolean
346
+ ```
0 commit comments