Twitter | Search | |
Sander Elias @🇳🇱
I'm in 😍 with Ivy! ♥♥♥ It finally enabled me to write an custom decorator to make observable life-cycle hooks. No more need of adding placeholder `ngOnxxx` the code below is actually working code. Once ivy is released I will release this too! 🎉🎉🔥🔥🎉🎉
Reply Retweet Like More
Trotyl Yu 19 Dec 18
Not quite true, static properties are all being evaluated before decorators, and lifecycle hooks are determined eagerly under `defineComponent` call. The only way is to alter the result of `ngComponentDef`, which typed as `never` and not a public API, otherwise it's JIT-only.
Reply Retweet Like
Sander Elias @🇳🇱 19 Dec 18
Replying to @trotylyu @angular
I'm running in AOT mode.
Reply Retweet Like
Leon Radley 18 Dec 18
Nice! Would it be able to use the OnInit interface instead of the magic strings, inside the decorator?
Reply Retweet Like
Sander Elias @🇳🇱 18 Dec 18
Replying to @LeonRadley @angular
Did a quick check. the `OnInit` interface has no runtime representation. (the same for the others) That means that I don't see a way to do it now. I'm open for suggestions. If any one has a clue how to pull that off, I'm more as happy to implement.
Reply Retweet Like
Aslan Vatsaev 🇫🇷 🥨 18 Dec 18
Is this documented?
Reply Retweet Like
Sander Elias @🇳🇱 18 Dec 18
Replying to @avatsaev @angular
No. Ivy isn't ready yet, and my decorator can't be released before that, so there is little use in my documenting it ,😁
Reply Retweet Like
nuton.dev 18 Dec 18
TBH I could live with the hooks, but I would love to have observables of ViewChild events... :)
Reply Retweet Like
Sander Elias @🇳🇱 18 Dec 18
Next on my list.
Reply Retweet Like
Thomas Burleson 19 Dec 18
How do these dynamic hooks work under the hood WRT the compiler. How does the compiler know the methods exist ?
Reply Retweet Like
Juri Strumpflohner 19 Dec 18
curious as well 😊
Reply Retweet Like