How to collect decorated elements info after class defination?
ruojianll opened this issue · 2 comments
ruojianll commented
I'm writing a decorator package to translate class to vue options api. So I need to collect which elements decorated as methods, lifecycle hooks, data or computed value. In legacy decorators, I could put them name in a class's prototype symbol and bundle them in to an object. But in stage3 I can't access class's prototype. Where should I put the info about decorated elements per class? Should I use state2 metadata or we let the class prototype accessible?
@Component
class MyComp{
@Method
m(){}
@Lifecycle
mounted(){}
}
to
{
methods:{
m(){}
},
mounted(){}
}
pzuraq commented
This is what stage 2 metadata aims to address, yes. The class prototype will not be accessible directly from decorators, that was a hard requirement from committee.
pzuraq commented
Closing this issue as it has been answered.