Closed hbroer closed 2 years ago
Merging #22 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #22 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 53 75 +22
Branches 9 16 +7
=====================================
+ Hits 53 75 +22
Impacted Files | Coverage Δ | |
---|---|---|
src/ioc/inject.ts | 100% <100%> (ø) |
:arrow_up: |
src/ioc/container.ts | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 935df56...03f037d. Read the comment docs.
Feels like this eats too many bytes at the moment.
854 B: ioc.js.gz
733 B: ioc.js.br
862 B: ioc.mjs.gz
734 B: ioc.mjs.br
I close this in favor of another solution
I am working with react and preact the most times, and one of the code i have to write over and over again is to subscribe to listener on
componentWillMount
or on the construction and unsubscribe oncomponentWillUnmount
.To fix this i am thinking about to implement some kind of automatism. Just telling the inject decorator to subscribe and it will do it for me.
Component has the method
forceUpdate()
and can havecomponentWillUnmount()
.When we access
updateable.service
it should subscribe toSubscribable
. When evertrigger()
is executedforceUpdate()
onUpdateable
should get executed.This is work in progress.
When
Updateable
will get unmounted and its methodcomponentWillUnmount
gets triggered, it should unsubscribe fromSubscribable
.