Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 48 additions & 6 deletions docs/Interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -653,31 +653,36 @@ MY_COLLECTION.getSelector(1); // Returns Selector that got just created
|--------------------------|-----------|----------|
| `boolean` | false | No |



<br/>

---

<br/>



## `UpdateConfig`

This is the `UpdateConfig` Interface, and it is used as config object in the `update` method. Here is a Typescript
Interface of the Object for quick reference, however each property will be explained in more detail below.

```ts
export interface UpdateConfigInterface {
addNewProperties?: boolean;
patch?: boolean | { addNewProperties?: boolean };
background?: boolean;
}
```

#### `addNewProperties`

If new properties that hasn't exist before, get added to the Item Value.
#### `patch`

If the update data object should be merged into the existing data or overwrite it completely.
In case we want to merge the data into the existing data,
we can decide wether new properties are added to the data object or not.
```ts {2}
MY_COLLECTION.collect({id: 1, name: "jeff"});
MY_COLLECTION.update(1, {name: "hans", age: 12}, {addNewProperties: false}); // Item at '1' has value '{name: "hans"}'
MY_COLLECTION.update(1, {name: "hans", age: 12}, {patch: {addNewProperties: false}}); // Item at '1' has value '{name: "hans"}'
MY_COLLECTION.update(1, {name: "frank", age: 10}); // Item at '1' has value '{name: "frank", age: 10}'
```

Expand All @@ -702,4 +707,41 @@ MY_COLLECTION.update(1, {name: "frank"}, {background: true});

| Type | Default | Required |
|--------------------------|-----------|----------|
| `boolean` | false | No |
| `boolean` | false | No |



<br/>

---

<br/>



## `HasConfig`

This is the `HasConfig` Interface, and it is used as config object in methods like `hasGroup`, `hasSelector`, .. Here is a Typescript
Interface of the Object for quick reference, however each property will be explained in more detail below.

```ts
export interface HasConfigInterface {
notExisting?: boolean;
}
```

#### `notExisting`

Should be set to `true`, if also not existing Instances should be returned, like `placeholder` Instances.

```ts {2,5}
// Returns placeholder Group
MY_COLLECTION.hasGroup('myPlaceholderGroup', {notExisting: true});

// Returns undefined
MY_COLLECTION.hasGroup('myPlaceholderGroup');
```

| Type | Default | Required |
|--------------------------|-----------|----------|
| `boolean` | false | No |
Loading