onready callback not being made after upgrade to 1.21.

  • Greetings,

    I've been using krpano 1.20.11 successfully for quite some time now and it's been excellent. However, I'm running into some trouble trying to upgrade to 1.21.

    For some background, the current setup I have (which works) is using version 1.20.11, is written in Typescript, where I added the following to the bottom of krpano.js:

    module.exports.embedpano = embedpano; // export it

    ... then import it into my Typescript file with:

    import * as KRPano from '../vendor/krpano';

    ... and finally reference it in code:

    In 1.20.11, the call to embedpano worked as expected, and the onready callback was made successfully so I could do what I needed to after.

    However, when I followed the same exact steps in 1.21, this isn't the case. While embedpano does get called (so I know the import works), the onready callback is not invoked.I rely on this callback for the other things my code needs to do.

    Unfortunately, the code obfuscation makes it impossible for me to debug into it further and figure out why the callback isn't being made, or what the issue could be.

    I also did try the consolelog, debugmode options as well as disabling usestrictjs but I don't get any output unfortunately.

    As I mentioned, this does work with 1.20.11, but doesn't in 1.21 (and I can see there is quite a large difference between the two files). I need this upgrade to resolve some issues with iOS and gyros not working (among other things).

    Any help with this would be greatly appreciated. Thank you!

  • Good morning!

    This is part of a very large, proprietary codebase which I can't post. However, I've gone ahead and setup a super stripped-down example of the setup, including both versions of the library, which reproduces the issue here: https://github.com/travisvromanmarxent/krpanotest

    I made sure to detail the setup/structure of it in the readme, so hopefully this has everything you need.

    Thank you for looking into this! Please let me know if there is anything else you need.

  • Hi,

    okay, I see now - but I have to say it works as intended...

    There need to be the global 'krpanoJS' object with its functions and properties.
    When it's not there, the viewer will not load.

    In your example, you have fully inlined the code and so that global object doesn't exists anymore.

    Best regards,

  • Perfect, you gave me the exact hint I needed. Thank you!

    For anyone else running into this, I changed the module exports at the bottom of krpano.js to this:

    module.exports = krpanoJS;

    Then, in my TS I changed my import to:

    import krpanoJS from '../vendor/krpano';

    and later on added this to make sure the krpanoJS object stays global:

    (window as any).krpanoJS = krpanoJS;

    Finally I changed my references to my original imported alias of KRPano to krpanoJS and everything works as expected.

    Thank you again, Klaus!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!