[Help] looking for help with EventListener

This is probably not the intended usage of it but you could use another script called WK Item Info Injector to get that information easily:

It’s meant for adding extra sections to the item info (for example in reviews) but you can also just get the item ID from it. Here is an example of how that would work (for setup and further documentation see the thread I linked to):

window.wkItemInfo.notify({id} => doSomethingWith(id))

Basically you have to first ‘require’ the script at the top of your own script and then you can use it in your code (the notify function is what you want to not invoke the info section injection). Your code could look like this (although this way might not be the prettiest):

window.addEventListener('didCompleteSubject', 
    (event) => window.wkItemInfo.notify({id} => {
         dothething(event, id); // can use both id and event here
    })
);

@Sinyaven Tell me if I did something wrong :sweat_smile:

Edit: Changed event as suggested by Kumirei

1 Like