@@ -15,7 +15,7 @@ Here all methods of the `Agile Instance` are described.
1515## ` createState() `
1616
1717Creates 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.
1919``` ts
2020const State = App .createState (' jeff' , {
2121 key: ' dummyState' ,
@@ -30,6 +30,10 @@ const State = App.createState('jeff', {
3030| ` config ` | [ StateConfigInterface] ( ../../../../Interfaces.md#stateconfig ) | {} | Configuration | No |
3131
3232### 📄 Return
33+
34+ ``` ts
35+ State
36+ ```
3337Returns a fresh [ State] ( ../state/Introduction.md ) .
3438
3539
@@ -45,7 +49,7 @@ Returns a fresh [State](../state/Introduction.md).
4549## ` createCollection() `
4650
4751Creates 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.
4953``` ts {1-4,8-13}
5054const Collection = App .createCollection ({
5155 key: ' dummyCollection' ,
@@ -70,6 +74,10 @@ const Collection2 = App.createCollection((collection) => ({
7074
7175
7276### 📄 Return
77+
78+ ``` ts
79+ Collection
80+ ```
7381Returns a fresh [ Collection] ( ../collection/Introduction.md ) .
7482
7583
@@ -85,7 +93,7 @@ Returns a fresh [Collection](../collection/Introduction.md).
8593## ` createComputed() `
8694
8795Creates 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.
8997``` ts {1,5-7}
9098const Computed = App .createComputed (() => {/* Computed Method */ }, [/* hard coded deps */ ])
9199
@@ -105,6 +113,10 @@ const ComputedWithConfig = App.createComputed(() => {/* Computed Method */}, {
105113| ` deps ` | Array<Observer \| State \| Event \| Group\> | [ ] | Dependencies of Computed | No |
106114
107115### 📄 Return
116+
117+ ``` ts
118+ Computed
119+ ```
108120Returns a fresh [ Computed] ( ../computed/Introduction.md ) .
109121
110122
@@ -120,7 +132,7 @@ Returns a fresh [Computed](../computed/Introduction.md).
120132## ` createEvent() `
121133
122134Creates 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.
124136``` ts
125137const Event = App .createEvent ({
126138 key: ' dummyEvent' ,
@@ -135,6 +147,10 @@ const Event = App.createEvent({
135147
136148
137149### 📄 Return
150+
151+ ``` ts
152+ Event
153+ ```
138154Returns a fresh [ Event] ( ../event/Introduction.md ) .
139155
140156
@@ -149,10 +165,18 @@ Returns a fresh [Event](../event/Introduction.md).
149165
150166## ` integrate() `
151167
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
156180const reactIntegration = new Integration <typeof React , AgileReactComponent >({
157181 key: ' react' ,
158182 frameworkInstance: React ,
@@ -177,11 +201,7 @@ const reactIntegration = new Integration<typeof React, AgileReactComponent>({
177201});
178202
179203// Each initialIntegraion gets integrated into AgileTs automatically during initialation
180- // Note: Only useful if you create your own integration
181204Agile .initialIntegrations .push (reactIntegration );
182-
183- // Or we integrate it manually (mostly the case if the auto integration doesn't work)
184- App .integrate (reactIntegration );
185205```
186206
187207### 📭 Props
@@ -191,6 +211,10 @@ App.integrate(reactIntegration);
191211| ` integration ` | [ Integration] ( ../integration/Introduction.md ) | undefined | Integration that gets registered/integrated into AgileTs | Yes |
192212
193213### 📄 Return
214+
215+ ``` ts
216+ Agile
217+ ```
194218Returns the [ Agile Instance] ( ./Introduction.md ) it was called from
195219
196220
@@ -204,10 +228,14 @@ Returns the [Agile Instance](./Introduction.md) it was called from
204228
205229
206230## ` hasIntegration() `
231+
207232Checks if AgileTs has any registered [ Integration] ( ../integration/Introduction.md ) .
208233
209234### 📄 Return
210- ` boolean `
235+
236+ ``` ts
237+ boolean
238+ ```
211239
212240
213241
@@ -221,7 +249,9 @@ Checks if AgileTs has any registered [Integration](../integration/Introduction.m
221249
222250## ` createStorage() `
223251
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.
225255``` ts
226256const Storage = App .createStorage ({
227257 key: ' dummyStorage' ,
@@ -232,7 +262,8 @@ const Storage = App.createStorage({
232262 }
233263})
234264```
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.
236267
237268### 📭 Props
238269
@@ -242,6 +273,10 @@ To register a newly created Storage, we use the [registerStorage](#registerstora
242273| ` methods ` | [ StorageMethodsInterface] ( ../../../../Interfaces.md#storagemethods ) | {} | Methods with which the Storage get mutated | Yes |
243274
244275### 📄 Return
276+
277+ ``` ts
278+ Storage
279+ ```
245280Returns a fresh [ Storage] ( ../storage/Introduction.md ) .
246281
247282
@@ -256,12 +291,13 @@ Returns a fresh [Storage](../storage/Introduction.md).
256291
257292## ` registerStorage() `
258293
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.
262298``` 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 ({
265301 key: ' localStorage' ,
266302 async: false ,
267303 methods: {
@@ -271,7 +307,7 @@ const _localStorage = new Storage({
271307 },
272308});
273309
274- // Here we register our Storage
310+ // Register Storage to current Agile Instance (App)
275311App .register (_localStorage , { default: true });
276312```
277313
@@ -282,6 +318,10 @@ App.register(_localStorage, { default: true });
282318| ` integration ` | [ Integration] ( ../integration/Introduction.md ) | undefined | Integration that gets registered/integrated into AgileTs | Yes |
283319
284320### 📄 Return
321+
322+ ``` ts
323+ Agile
324+ ```
285325Returns the [ Agile Instance] ( ./Introduction.md ) it was called from
286326
287327
@@ -295,8 +335,12 @@ Returns the [Agile Instance](./Introduction.md) it was called from
295335
296336
297337## ` hasStorage() `
338+
298339Checks 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 .
300341
301342### 📄 Return
302- ` boolean `
343+
344+ ``` ts
345+ boolean
346+ ```
0 commit comments