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

Commit 3ea3073

Browse files
committed
fixed typos
1 parent 95a5cc3 commit 3ea3073

File tree

23 files changed

+158
-277
lines changed

23 files changed

+158
-277
lines changed

docs/Interfaces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ During the overwrite process, the following properties are overwritten:
102102

103103
Whether to apply the State value changes to the corresponding external [Storage/s](packages/core/api/storage/Introduction.md).
104104
```ts {1}
105-
const MY_STATE = App.creacteState('jeff').persist('storageKey');
105+
const MY_STATE = createState('jeff').persist('storageKey');
106106
// Storage at 'storageKey': 'jeff'
107107
MY_STATE.set("hans", {storage: true});
108108
// Storage at 'storageKey': 'hans'
@@ -463,7 +463,7 @@ We recommend giving each Selector a unique `key` since it has only advantages:
463463

464464
Defines whether the Selector is a `placeholder`.
465465
```ts
466-
const MY_SELECTOR = App.creaateSelector(1, {
466+
const MY_SELECTOR = MY_COLLECTION.createSelector(1, {
467467
isPlaceholder: true
468468
});
469469

docs/main/Introduction.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ slug: /introduction/
2121
<br />
2222
<br />
2323

24+
:::info
25+
26+
Want to get a quick overview of AgileTs?
27+
Checkout the [AgileTs Introduction Blogpost](https://dev.to/bennodev19/createstate-introducing-agilets-a-flexible-state-manager-91f).
28+
29+
:::
30+
2431
## 👋 Introduction {#introduction}
2532

2633
AgileTs is a global State and Logic Library implemented in Typescript.

docs/main/StyleGuides.md

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Feel free to choose one of them and adapt it to your needs.
3737
## 🚀 Inspiration 1
3838

3939
The `Style Guide 1` is intended for **smaller and medium size applications**
40-
with about `1-3` entities. In AgileTs, `entities` are things with distinct
41-
and independent existence like users, posts, or todos.
40+
with about `1-3` entities. (In AgileTs, `entities` are things with distinct
41+
and independent existence like users, posts, or todos.)
4242
We put everything related to these entities
4343
into a single file of truth called `store.js` or `core.js`.
4444
In the end, the `core` file contains all the business logic of your application,
@@ -72,21 +72,20 @@ how it can be constructed.
7272

7373
### 📝 store.ts
7474

75-
In the `store.ts` file, we instantiate the Agile Instance (`Agile`)
76-
and define all [Agile Sub Instances](../main/Introduction.md#agile-sub-instance) (`MY_TODOS`).
77-
In addition, all actions (`updateTodo()`, `toogleTodo()`, ..)
78-
and if you are using Typescript interfaces (`TodoInterface`) are located here.
75+
In the `store.ts` file, we instantiate all [Agile Sub Instances](../main/Introduction.md#agile-sub-instance) (`MY_TODOS`),
76+
define all actions (`updateTodo()`, `toogleTodo()`, ..)
77+
and if you are using Typescript interfaces (`TodoInterface`) are located here too.
7978
```ts title="store.ts"
8079
import { createCollection } from "@agile-ts/core";
8180

82-
export interface TodoInterface {
81+
export interface TodoItemInterface {
8382
id: number;
8483
text: string;
8584
done: boolean;
8685
}
8786

8887
// Create Collection (a dynamic set of States)
89-
export const MY_TODOS = createCollection<TodoInterface>({
88+
export const MY_TODOS = createCollection<TodoItemInterface>({
9089
key: "todos"
9190
}).persist(); // perist does store the Collection in the Local Storage
9291

@@ -134,7 +133,7 @@ We can easily differentiate between global and local States in our UI-Components
134133

135134
The `Style Guide 2` is intended for **medium size and large applications**
136135
with more than `3` entities.
137-
In AgileTs, `entities` are things with distinct and independent existence like users, posts, or todos.
136+
(In AgileTs, `entities` are things with distinct and independent existence like users, posts, or todos.)
138137
At first glance, this way of organizing your application looks very boiler-late-ey.
139138
Each entity has its own directory with a bunch of files.
140139
However, there is a system behind it,
@@ -190,7 +189,6 @@ core
190189
| └── user.controller.ts
191190
| └── user.interfaces.ts
192191
| └── user.routes.ts
193-
|── app.ts
194192
|── index.ts
195193
.
196194
```
@@ -373,33 +371,6 @@ export const ADD_TODO = async (payload: AddTodoPayloadInterface): Promise<TodoIn
373371
// ..
374372
```
375373

376-
## 📝 app.ts
377-
378-
:::note
379-
380-
If you decided to use the
381-
[shared Agile Instance](../packages/core/api/agile-instance/Introduction.md#-shared-agile-instance)
382-
you can skip this part.
383-
384-
:::
385-
386-
In the `app.ts` file, we create our main `Agile Instance` and configure it to meet our needs.
387-
For example, we determine here with which UI-Framework AgileTs should work together.
388-
389-
```ts title="app.ts"
390-
import {Agile, Logger, assignSharedAgileInstance} from "@agile-ts/core";
391-
import reactIntegration from "@agile-ts/react";
392-
393-
export const App = new Agile({
394-
logConfig: {
395-
level: Logger.level.WARN
396-
}
397-
}).integrate(reactIntegration);
398-
399-
// Assign created Agile Instance as shared Agile Instance
400-
assignSharedAgileInstance(App);
401-
```
402-
403374
## 📝 index.ts
404375

405376
Here we export our `core` entities, so that each entity

docs/packages/core/api/agile-instance/Introduction.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ In summary the main tasks of the `Agile Class` are to:
4646

4747
## 🤝 `shared` Agile Instance
4848

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),
5050
although everything depends on it.
5151
That is due the fact that there exists a shared Agile Instance called `shared` in the background.
5252
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.
6464
```ts
6565
const App = new Agile({/* many config options */});
6666
```
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
6969
with the newly created Agile Instance.
7070
```ts
7171
assignSharedAgileInstance(App);
7272
```
7373
Otherwise, there would exist two instances of Agile
7474
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+
7581

7682
## 📭 Props
7783

@@ -84,20 +90,18 @@ new Agile(config);
8490
The `Agile Class` takes an optional configuration object as its only parameter.
8591
```ts
8692
new Agile({
87-
logConfig: {
88-
active: true,
89-
},
90-
localStorage: false
93+
key: 'main',
94+
bindGlobal: true
9195
});
9296
```
9397
Here is a Typescript Interface for quick reference. However,
9498
each property is explained in more detail below.
9599
```ts
96100
export interface CreateAgileConfigInterface {
97-
logConfig?: CreateLoggerConfigInterface;
98-
localStorage?: boolean;
99101
waitForMount?: boolean;
100102
bindGlobal?: boolean;
103+
key?: AgileKey;
104+
bucket?: boolean;
101105
}
102106
```
103107

@@ -116,47 +120,53 @@ new Agile({
116120
<br/>
117121

118122
#### `logConfig`
119-
120123
:::warning
121124

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`
123126
and is no longer available!
124127

128+
### Why?
129+
Optimizing `bundle size`.
130+
131+
### Alternative?
125132
Now, `warnings` and `errors` are logged in general.
126133
However, to configure the logging behavior of AgileTs more precisely
127134
an external package [`@agile-ts/logger`](../../../logger/Introduction.md) is required.
128-
129135
```ts
130-
import {Logger, assignSharedAgileLoggerConfig} from '@agile-ts/logger';
136+
import {assignSharedLogger, createLogger, Logger} from '@agile-ts/logger';
131137

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+
}));
139143
```
140144

141145
:::
142146

143147
<br/>
144148

145149
#### `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).
148162
```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);
152167
```
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.
156168

157-
| Type | Default | Required |
158-
|-----------------|-------------|----------|
159-
| `boolean` | true | No |
169+
:::
160170

161171
<br/>
162172

0 commit comments

Comments
 (0)