kakaroto / Beyond20

D&D Beyond Character Sheet Integration in Roll20
GNU General Public License v3.0
484 stars 141 forks source link

The "Beyond20*" events of the DOM API appear to not be triggered on DnD Beyond itself #1130

Open carrierfry opened 1 month ago

carrierfry commented 1 month ago

Describe the bug The Beyond20* events (like Beyond20_Loaded(settings)) do not get triggered when on DnD Beyond

To Reproduce Steps to reproduce the behavior:

  1. Create extension or userscript for DnD Beyond character sheet with following code and enable/load it:
    
    function addBeyond20EventListener(name, callback) {
    const event = ["Beyond20_" + name, (evt) => {
        const detail = evt.detail || [];
        callback(...detail)
    }, false];
    document.addEventListener(...event);
    return event;
    }

addBeyond20EventListener("Loaded", settings => { console.log("Beyond20_Loaded"); console.log(settings); });

console.log("Added event listener");


2. Open character sheet on DnD Beyond
3. Open DevTools
4. See missing console logs

**Expected behavior**
The `Beyond20*` events should work even on DnD Beyond itself to make 3rd party extensions be able to listen to those events there

**Screenshots**
![image](https://github.com/kakaroto/Beyond20/assets/20256939/271a6098-8c77-4054-895f-933abb69793c)

**Browser Info (please complete the following information):**
 - Browser Google Chrome
 - Version 125.0.6422.141