5
submitted 1 year ago* (last edited 1 year ago) by Rooki@lemmy.world to c/programming@programming.dev

I have currently:

A Class with multiple functions A Decorator that saves the function to a list

The problem:

When i call the function "this" is not the class ( or not yet initialized )

How can i implement it correctly?

My Class Function Decorator:

export function LemmyOn(data: ILemmyOn) {  

  return function (  
    target: Object,  
    propertyKey: string | symbol,  
    descriptor: TypedPropertyDescriptor<any>  
  ) {  

    events.push({ data: data, fn: descriptor.value });  
    return descriptor;  
  };
}
top 6 comments
sorted by: hot top controversial new old
[-] rmam@programming.dev 2 points 1 year ago* (last edited 1 year ago)

Here's a friendly reminder that there's a TypeScript community in programming.dev.

https://programming.dev/c/typescript

Hi there! Looks like you linked to a Lemmy community using a URL instead of its name, which doesn't work well for people on different instances. Try fixing it like this: !typescript@programming.dev

[-] rmam@programming.dev 1 points 1 year ago* (last edited 1 year ago)
[-] TerrorBite@meow.social 1 points 1 year ago

@rmam Wow, this looks a bit broken on Mastodon… but it's still clickable.

[-] TerrorBite@meow.social 1 points 1 year ago

Hi @rikudou, your bot incorrectly flags for Mastodon users. I have to tag the community in my post, or it won't federate. And Mastodon tags seem to look like URLs to the bot.

@programming

[-] rikudou@lemmings.world 1 points 1 year ago

Hi, new version has been released and it now shouldn't fix links for Mastodon users, if the link is the same as the community the reply is in. Meaning if you tag other communities, it will reply with links only for them, but it won't reply if you tag just one community to post into it.

load more comments
view more: next ›
this post was submitted on 18 Jul 2023
5 points (100.0% liked)

Programming

17314 readers
72 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS