rt-2

Events' "this" not working.

Recommended Posts

Hello everyone,
I previously used 'var.destroy();' successfuly, now I wanted to try the new event functions.

When I try to use the new 'this' in events it doesn't work AT ALL.

mp.events.add('anEvent', function (arg) {

     this.handler //Undefined???

     this.cancel //Undefined???

});


new mp.Events('anEvent', function (arg) {

     this.handler //Undefined???

     this.cancel //Undefined???

});


mp.events.add('anEvent', (arg) => {

     this.handler //Undefined???

     this.cancel //Undefined???

});


new mp.Events('anEvent', (arg) => {

     this.handler //Undefined???

     this.cancel //Undefined???

});


and this.handler.destroy() also returns an error.

After asking in the discord channel it seems like nobody could tell me if they ever used it or what was wrong.

Maybe it works but AS DESCRIBED in the changelog it doesn't work.


Thank you,

rt-2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.