#How to get the name or propertyKey of all the functions/methods with @Decorator

2 messages · Page 1 of 1 (latest)

novel lark
#

I'm currently working on a framework for my discord bot created using discord.js (https://discord.js.org/). While creating the EventHandler, I wanted to add decorators like Nest.js' @Get, @Post, etc... for events in a class. But I faced a problem while implementing it using reflect-metadata (https://github.com/rbuckton/reflect-metadata). I'm aware that we can get the metadata for a function using the propertyKey using

class Event {
    // ...

    @On('ready')
    async execute() {
        // ...
    }
}

Reflect.getMetadata(EventData, Event.prototype, 'execute'),

But I need to get the propertyKeys of all the functions/properties with the decorator. I'm not able to figure out how can I achieve it.
If anyone could help me I would really appreciate it.

- Thank you

molten talon
#

I am not quite sure what you are trying?