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

Commit 51fac46

Browse files
committed
created default Agile Instance methods docs
1 parent 3070827 commit 51fac46

File tree

6 files changed

+289
-83
lines changed

6 files changed

+289
-83
lines changed

docs/Interfaces.md

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,35 @@ Here are all documented Interfaces of AgileTs listed!
1212
:::
1313

1414

15+
### `CreateLoggerConfig`
16+
17+
```ts
18+
export interface CreateLoggerConfigInterface {
19+
prefix?: string;
20+
allowedTags?: string[];
21+
canUseCustomStyles?: boolean;
22+
active?: boolean;
23+
level?: number;
24+
timestamp?: boolean;
25+
}
26+
```
27+
28+
| Prop | Type | Default | Description | Required |
29+
|----------------------|----------|--------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|----------|
30+
| `level` | number | 20 (Logger.level.WARN) | On which 'level' the logger should log. For instance if it only should log Errors. | No |
31+
| `active` | boolean | true | If the Logger is active. | No |
32+
| `timestamp` | boolean | false | If a Timestamp gets applied for each Log Message. | No |
33+
| `allowedTags` | string[] | ['runtime', 'storage', 'subscription', 'multieditor'] | Sometimes logs are marked with Tags. If this is the case, the log gets only logged if the Tag is included. | No |
34+
| `canUseCustomStyles` | boolean | true | If the Logger is allowed to apply css styles to the Logs. For instance Agile Logs are by default purple. | No |
35+
36+
37+
<br/>
38+
39+
---
40+
41+
<br/>
42+
43+
1544
### `StorageMethods`
1645

1746
```ts
@@ -46,11 +75,11 @@ export interface StateConfigInterface {
4675
}
4776
```
4877

49-
| Prop | Type | Default | Description | Required |
50-
|-----------------|------------------|-----------|-----------------------------------------------------------------------------------------------------------|----------|
78+
| Prop | Type | Default | Description | Required |
79+
|-----------------|--------------------|-----------|-----------------------------------------------------------------------------------------------------------|----------|
5180
| `key` | `string \| number` | undefined | Key/Name of State | No |
52-
| `dependents` | Observer[] | [] | Initial dependents of the State -> if State mutates, the dependents will be ingested into the Runtime too | No |
53-
| `isPlaceholder` | boolean | false | If State is a placeholder, to hold a reference (used internal) | No |
81+
| `dependents` | Observer[] | [] | Initial dependents of the State -> if State mutates, the dependents will be ingested into the Runtime too | No |
82+
| `isPlaceholder` | boolean | false | If State is a placeholder, to hold a reference (used internal) | No |
5483

5584

5685
<br/>
@@ -123,3 +152,34 @@ export interface CreateCollectionConfigInterface<DataType = DefaultItem> {
123152
| `defaultGroupKey` | GroupKey | 'default' | How the default Group, which represents the main representation of the Collection, is called. | No |
124153
| `initialData` | Array< DataType > | [] | Initial Data of Collection | No |
125154

155+
156+
<br/>
157+
158+
---
159+
160+
<br/>
161+
162+
163+
### `CreateEventConfig`
164+
165+
```ts
166+
export interface CreateEventConfigInterface {
167+
key?: EventKey;
168+
enabled?: boolean;
169+
maxUses?: number;
170+
delay?: number;
171+
overlap?: boolean;
172+
rerender?: boolean;
173+
dependents?: Array<Observer>;
174+
}
175+
```
176+
177+
| Prop | Type | Default | Description | Required |
178+
|--------------|------------------|-----------|-----------------------------------------------------------------------------------------------------------|----------|
179+
| `key` | string \| number | undefined | Key/Name of Event | No |
180+
| `enabled` | boolean | true | If Event is enabled and can be triggered | No |
181+
| `maxUses` | number | undefined | How often the Event can be triggered, by default infinite | No |
182+
| `delay` | number (in ms) | undefined | If the Event should have an trigger delay | No |
183+
| `overlap` | boolean | false | If a triggered Event can overlap another triggered Event from same Event Class | No |
184+
| `rerender` | boolean | false | If a Event trigger can rerender a Component (useEvent) | No |
185+
| `dependents` | Observer[] | [] | Initial dependents of the State -> if State mutates, the dependents will be ingested into the Runtime too | No |

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

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ sidebar_label: Introduction
55
slug: /core/agile-instance
66
---
77

8-
The Agile Instance is created with `new Agile()`and should be unique to your application.
8+
The _Agile Instance_ is created with `new Agile()`and should be unique to our application.
99
```ts
1010
const App = new Agile();
1111
```
12-
With an instantiated Agile Instance, we are able to create any Agile Sub Instance like
12+
With an instantiated _Agile Instance_, we are able to create any Agile Sub Instances like
1313
- [State](../state/Introduction.md)
1414
```ts
1515
const MY_STATE = App.createState("Hello there");
@@ -27,19 +27,19 @@ With an instantiated Agile Instance, we are able to create any Agile Sub Instanc
2727
const MY_EVENT = App.createEvent();
2828
```
2929

30-
These Sub Instances created with the help of the `Agile Class` are automatically added to it.
31-
Because of that a `Agile Class` can also be seen as a Store,
30+
These Sub Instances created with the help of the `Agile Class` are automatically bound to it.
31+
Because of the storing behaviour, the `Agile Class` can also be seen as a Store,
3232
that offers many features to mutate and work with the stored Instances.
3333

34-
## Configuration Options
34+
## 📭 Props
3535

3636
`Agile` takes an optional configuration object as its only parameter.
3737
```ts
3838
const App = new Agile({
39-
logConfig: {
40-
level: Logger.level.DEBUG,
39+
logConfig: {
4140
active: true,
4241
},
42+
localStorage: false
4343
});
4444
```
4545
Here is a Typescript Interface for quick reference, however
@@ -56,27 +56,16 @@ export interface CreateAgileConfigInterface {
5656

5757
The logConfig is thought to configure the Logger of AgileTs.
5858
For instance, we can configure if we want to log all messages or
59-
only warnings.
59+
only warnings. [Here](../../../../Interfaces.md#createloggerconfig) you can find all configuration options.
6060
```ts
61-
export interface CreateLoggerConfigInterface {
62-
prefix?: string;
63-
allowedTags?: string[];
64-
canUseCustomStyles?: boolean;
65-
active?: boolean;
66-
level?: number;
67-
timestamp?: boolean;
68-
}
61+
const App = new Agile({
62+
logConfig: {
63+
level: Logger.level.ERROR, // print only errors
64+
active: true,
65+
},
66+
});
6967
```
7068

71-
| Prop | Type | Default | Description | Required |
72-
|----------------------|----------|--------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|----------|
73-
| `level` | number | 20 (Logger.level.WARN) | On which 'level' the logger should log. For instance if it only should log Errors. | No |
74-
| `active` | boolean | true | If the Logger is active. | No |
75-
| `timestamp` | boolean | false | If a Timestamp gets applied for each Log Message. | No |
76-
| `allowedTags` | string[] | ['runtime', 'storage', 'subscription', 'multieditor'] | Sometimes logs are marked with Tags. If this is the case, the log gets only logged if the Tag is included. | No |
77-
| `canUseCustomStyles` | boolean | true | If the Logger is allowed to apply css styles to the Logs. For instance Agile Logs are by default purple. | No |
78-
79-
8069

8170
### `localStorage`
8271

@@ -85,19 +74,28 @@ If we use the Local Storage each Agile Sub Instance we persist, gets stored in t
8574
We aren't limited to the Local Storage, we can configure our own [Storage](../storage/Introduction.md).
8675
This is in a Mobile Environment necessary, because there the Local Storage doesn't exist.
8776
With `App.registerStorage()` we can register our wished [Storage](../storage/Introduction.md).
88-
````ts
89-
localStorage: false // default true
90-
````
77+
```ts
78+
const App = new Agile({
79+
localStorage: false // default true
80+
});
81+
```
9182

9283
### `waitForMount`
9384

9485
With `waitForMount` we define if AgileTs should wait
9586
with causing rerender on an unmounted Component until it got mounted.
96-
````ts
97-
waitForMount: false // default true
98-
````
87+
```ts
88+
const App = new Agile({
89+
waitForMount: false // default true
90+
});
91+
```
92+
93+
94+
## 🟦 Typescript
95+
96+
`Agile Class` is almost 100% typesafe.
9997

100-
## Where to instantiate?
98+
## 🗺 Where to instantiate?
10199

102100
You can instantiate the Agile Instance where ever you want.
103101
Directly in your Component, in an extra File or on Paper.

0 commit comments

Comments
 (0)