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

Commit fde01c7

Browse files
authored
Merge pull request #72 from agile-ts/develop
Develop
2 parents d94516c + c3ebfe7 commit fde01c7

File tree

13 files changed

+2460
-1452
lines changed

13 files changed

+2460
-1452
lines changed

docs/Interfaces.md

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -653,31 +653,36 @@ MY_COLLECTION.getSelector(1); // Returns Selector that got just created
653653
|--------------------------|-----------|----------|
654654
| `boolean` | false | No |
655655

656+
657+
656658
<br/>
657659

658660
---
659661

660662
<br/>
661663

664+
665+
662666
## `UpdateConfig`
663667

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

667671
```ts
668672
export interface UpdateConfigInterface {
669-
addNewProperties?: boolean;
673+
patch?: boolean | { addNewProperties?: boolean };
670674
background?: boolean;
671675
}
672676
```
673677

674-
#### `addNewProperties`
675-
676-
If new properties that hasn't exist before, get added to the Item Value.
678+
#### `patch`
677679

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

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

703708
| Type | Default | Required |
704709
|--------------------------|-----------|----------|
705-
| `boolean` | false | No |
710+
| `boolean` | false | No |
711+
712+
713+
714+
<br/>
715+
716+
---
717+
718+
<br/>
719+
720+
721+
722+
## `HasConfig`
723+
724+
This is the `HasConfig` Interface, and it is used as config object in methods like `hasGroup`, `hasSelector`, .. Here is a Typescript
725+
Interface of the Object for quick reference, however each property will be explained in more detail below.
726+
727+
```ts
728+
export interface HasConfigInterface {
729+
notExisting?: boolean;
730+
}
731+
```
732+
733+
#### `notExisting`
734+
735+
Should be set to `true`, if also not existing Instances should be returned, like `placeholder` Instances.
736+
737+
```ts {2,5}
738+
// Returns placeholder Group
739+
MY_COLLECTION.hasGroup('myPlaceholderGroup', {notExisting: true});
740+
741+
// Returns undefined
742+
MY_COLLECTION.hasGroup('myPlaceholderGroup');
743+
```
744+
745+
| Type | Default | Required |
746+
|--------------------------|-----------|----------|
747+
| `boolean` | false | No |

0 commit comments

Comments
 (0)