AadamZ5 / AadamZ5/jection

Consider Angular-style `inject` functions in injection contexts

Aperta
#3 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
TypeScript
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

This would likely be a large change.

Angular keeps track of injection contexts by keeping a "stack" of contexts. It is a synchronous system. Running in an injection context involves assigning a global variable as part of a wrapper function.

For example, Something like `runInInjectionContext(yourCallback, injector)` would populate a global variable `CURRENT_CONTEXT` to define the injection context. All code running inside the callback `yourCallback` would have access to that context. Once the `yourCallback` returns, the wrapper function `runInInjectionContext` would destruct the context, essentially assigning the global `CURRENT_CONTEXT` to something like `undefined`.

There could potentially be more involved ways to keep the injection context non-global, such as using some sort of function symbol or modifying function prototypes, but that can get messy. Perhaps traversing up a `caller` chain could also do this as well.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

The issue describes adding Angular-style injection contexts. Start by examining the existing injector and dependency injection mechanisms in the codebase. Look for how contexts are currently managed and where a global or call-stack based context could be integrated. Understanding the synchronous wrapper pattern and the potential impact on the framework's architecture is key.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
backend-api-design
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.