Skip to content

Commit

Permalink
Merge pull request #98 from ivandotv/set-parent
Browse files Browse the repository at this point in the history
implement setParent method
  • Loading branch information
ivandotv authored Oct 23, 2024
2 parents d8ff927 + 36ce6ca commit 7a732e4
Show file tree
Hide file tree
Showing 6 changed files with 536 additions and 396 deletions.
6 changes: 6 additions & 0 deletions .changeset/nice-islands-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"pumpit": minor
---

add `setParent` method.
Child container can set parent container connection
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ container.unbind(TestA) //throws error
```
## Child containers

Every container instance can create a **child** container.
Every container instance can create a **child** container. Or every container can set it's parent.

The child container is a new `PumpIt` instance that is connected to the parent container instance and it inherits all the values that are registered with the parent.

Expand All @@ -612,7 +612,8 @@ The child container can have the same `key` as the parent, in that case when the
```ts
const parent = new PumpIt()
const child = parent.child()

//or child = new Pumpit()
// child.setParent(parent)
const key = 'some_key'

class ParentClass {}
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
"homepage": "https://github.com/ivandotv/pumpit#readme",
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@changesets/cli": "^2.27.7",
"@vitest/coverage-v8": "^2.0.5",
"lefthook": "^1.7.11",
"@changesets/cli": "^2.27.9",
"@vitest/coverage-v8": "^2.1.3",
"lefthook": "^1.8.1",
"microbundle": "^0.15.1",
"shx": "^0.3.4",
"typedoc": "^0.26.5",
"typedoc-plugin-markdown": "^4.2.3",
"typescript": "^5.5.4",
"vitest": "^2.0.5"
"typedoc": "^0.26.10",
"typedoc-plugin-markdown": "^4.2.9",
"typescript": "^5.6.3",
"vitest": "^2.1.3"
}
}
Loading

0 comments on commit 7a732e4

Please sign in to comment.