Comments (3)
Initial thought it is export an additional injectDebug() function. (To make it tree shakeable)
That sounds easiest to maintain, but it might be limited by or breaking encapsulation in places?
Replacing the implementation of entire core files would be a potential alternative I've seen in other projects. Applying that here it would mean: Copy injector.ts: injector.debug.ts, sprinkle in many console.debug statements or save debug info into arrays to be inspected later ... e.g. especially where undefined
is returned. Although it is worse to maintain (code duplication), it does not tempt you to break encapsulation or rather gives you full freedom of debuggability.
from joist.
Another though would be to add the ability to pass a debug function to inject(). Inject(Service, { debug })
from joist.
One debugging usecase, counting instances:
// in some element:
static providers = [{ provide: EconomyService, use: EconomyService }]; // force a new instance for each element
// then I need to decorate my service like this to debug the amount of actual instances created (and alive?!):
@injectable
export class EconomyService {
static count = 0;
constructor() {
EconomyService.count++;
console.log('E', EconomyService.count);
}
}
from joist.
Related Issues (20)
- Styles
- runtime property validation
- Allow handlers to use pattern to match actions.
- Decorators should account for ts decorators and the standards proposal HOT 1
- Better test coverage of router
- Migrate from karma to web-test-runner
- Batch property changes
- Dev Tools HOT 1
- Dependency Dashboard
- @joist/di: lint rule for inject array not matching Injected types.
- @joist/di: implement lint fix to autofill injected services
- @joist/di: clear local cached instances on disconnect and connect
- SSR
- 3.0
- Example on how to use this toolkit with Lit HOT 10
- Cannot register element before dom renders with @attr
- Custom Element definition order matters HOT 4
- Add option for inject to require a manually defined dependency. HOT 9
- Create a non constructable ProviderToken HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joist.