@@ -46,7 +46,7 @@ In summary the main tasks of the `Agile Class` are to:
46
46
47
47
## 🤝 ` shared ` Agile Instance
48
48
49
- In most cases you won't come in direct contact with the hidden helper (Agile Instance),
49
+ In most cases you won't come in direct contact with this hidden helper (Agile Instance),
50
50
although everything depends on it.
51
51
That is due the fact that there exists a shared Agile Instance called ` shared ` in the background.
52
52
The shared Instance allows the easy and straightforward creation of [ ASI's] ( ../../../../main/Introduction.md#agile-sub-instance ) ,
@@ -64,14 +64,20 @@ you have to redefine it.
64
64
``` ts
65
65
const App = new Agile ({/* many config options */ });
66
66
```
67
- Once you have created your own Agile Instance,
68
- we recommend that you overwrite the ` shared ` Agile Instance
67
+ Once you have created your customized Agile Instance,
68
+ we recommend overwriting the ` shared ` Agile Instance
69
69
with the newly created Agile Instance.
70
70
``` ts
71
71
assignSharedAgileInstance (App );
72
72
```
73
73
Otherwise, there would exist two instances of Agile
74
74
which is an unnecessary use of memory.
75
+ Also, is the straightforward creation of States based on the shared Agile Instance.
76
+ ``` ts
77
+ createState (' jeff' ); // Uses the shared Agile Instance
78
+ createState (' jeff' , {agileInstance: App }); // Uses the specified Agile Instance
79
+ ```
80
+
75
81
76
82
## 📭 Props
77
83
@@ -84,20 +90,18 @@ new Agile(config);
84
90
The ` Agile Class ` takes an optional configuration object as its only parameter.
85
91
``` ts
86
92
new Agile ({
87
- logConfig: {
88
- active: true ,
89
- },
90
- localStorage: false
93
+ key: ' main' ,
94
+ bindGlobal: true
91
95
});
92
96
```
93
97
Here is a Typescript Interface for quick reference. However,
94
98
each property is explained in more detail below.
95
99
``` ts
96
100
export interface CreateAgileConfigInterface {
97
- logConfig? : CreateLoggerConfigInterface ;
98
- localStorage? : boolean ;
99
101
waitForMount? : boolean ;
100
102
bindGlobal? : boolean ;
103
+ key? : AgileKey ;
104
+ bucket? : boolean ;
101
105
}
102
106
```
103
107
@@ -116,47 +120,53 @@ new Agile({
116
120
<br />
117
121
118
122
#### ` logConfig `
119
-
120
123
::: warning
121
124
122
- The ` loggerConfig ` configuration option has been deprecated in the latest version ` ^0.1.1 `
125
+ The ` loggerConfig ` configuration option has been deprecated in the latest versions ` ^0.1.1 `
123
126
and is no longer available!
124
127
128
+ ### Why?
129
+ Optimizing ` bundle size ` .
130
+
131
+ ### Alternative?
125
132
Now, ` warnings ` and ` errors ` are logged in general.
126
133
However, to configure the logging behavior of AgileTs more precisely
127
134
an external package [ ` @agile-ts/logger ` ] ( ../../../logger/Introduction.md ) is required.
128
-
129
135
``` ts
130
- import {Logger , assignSharedAgileLoggerConfig } from ' @agile-ts/logger' ;
136
+ import {assignSharedLogger , createLogger , Logger } from ' @agile-ts/logger' ;
131
137
132
- assignSharedAgileLoggerConfig ({
133
- logConfig: {
134
- level: Logger .level .DEBUG ,
135
- active: true ,
136
- timestamp: true
137
- }
138
- });
138
+ assignSharedLogger (createLogger ({
139
+ level: Logger .level .DEBUG ,
140
+ active: true ,
141
+ timestamp: true
142
+ }));
139
143
```
140
144
141
145
:::
142
146
143
147
<br />
144
148
145
149
#### ` localStorage `
146
- Whether AgileTs should create an interface to the [ Local Storage] ( https://www.w3schools.com/html/html5_webstorage.asp ) and set it as default Storage.
147
- Each [ Agile Sub Instance] ( ../../../../main/Introduction.md#agile-sub-instance ) we persist (` .persist() ` ), will then be stored in the ` localStorage ` by default.
150
+ ::: warning
151
+
152
+ The ` localStorage ` configuration option has been deprecated in the latest versions ` ^0.2.0 `
153
+ and is no longer available!
154
+
155
+ ### Why?
156
+ Optimizing ` tree shaking ` support.
157
+
158
+ ### Alternative?
159
+ Now, the local storage is added by default.
160
+ However, to configure this behavior,
161
+ we need to assign a custom shared [ ` Storage Manger ` ] ( ../storage/Introduction.md ) .
148
162
``` ts
149
- new Agile ({
150
- localStorage: false // default true
151
- });
163
+ import {createStorageManager , assignSharedStorageManager } from " @agile-ts/core" ;
164
+
165
+ const storageManager = createStorageManager ({ localStorage: false });
166
+ assignSharedStorageManager (storageManager );
152
167
```
153
- We aren't limited to the ` localStorage ` and can create Interfaces to nearly any [ Storage] ( ../storage/Introduction.md ) we prefer saving data in.
154
- For instance, that is necessary for a Mobile Environment since the ` localStorage ` doesn't exist, and we have to resort to the Async Storage.
155
- With ` App.registerStorage() ` we register a new [ Storage] ( ../storage/Introduction.md ) to AgileTs.
156
168
157
- | Type | Default | Required |
158
- | -----------------| -------------| ----------|
159
- | ` boolean ` | true | No |
169
+ :::
160
170
161
171
<br />
162
172
0 commit comments