how to register a new event with window.addEventListener?

0 favourites
  • 2 posts
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • Hello there,

    I would like to register a new event using window.addEventListener which is thrown by a chrome extension but Construct is not picking it up for some reason.

    I would like to integrate the following:

    neoline.io/dapi/N3.html

    Could someone point me in the right direction? Thank you

    let neoline;
    function initDapi() {
     const initCommonDapi = new Promise((resolve, reject) => {
     window.addEventListener('NEOLine.NEO.EVENT.READY', () => {
     neoline = new NEOLine.Init();
     if (neoline) {
     resolve(neoline);
     } else {
     reject('common dAPI method failed to load.');
     }
     });
     });
    };
    
    initDapi();
     

    /edit: upon further research, it looks like it only doesn't pick up the ready event of the extension. The other events are caught correctly.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Alright, for anyone with a similar issue. I made it work by importing the javascript file of the chrome extension into the construct script file.

    I didn't think this would be required and I am still confused why I had to do this but it works for now so it's all good!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)