You are not logged in.

1

Tuesday, May 23rd 2023, 8:19pm

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:

Source code

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


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

Source code

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


... and finally reference it in code:

Source code

1
2
3
4
5
6
7
8
9
10
11
        KRPano.embedpano({
            xml: null,
            target: targetId,
            html5: 'only+webgl',
            mobilescale: 1.0,
            onready: this.krpanoOnReady.bind(this), // bound member function
            onerror: this.krpanoOnError.bind(this), // bound member function
            consolelog: true,
            debugmode: true,
            usestrictjs: false,
        });


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!

2

Wednesday, May 24th 2023, 10:49am

Hi,

do you have a link to your example?

So far I can't image any reasons why onready wouldn't be get called...

Best regards,
Klaus

3

Wednesday, May 24th 2023, 3:14pm

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.

4

Tuesday, May 30th 2023, 1:51pm

Please post a link to a ready/complied/running example (or an archive of such example).

5

Wednesday, May 31st 2023, 5:19pm

Apologies for the delay, I had to work out somewhere to host this.

Anyway, here are links to 2 versions of this, compiled/running.

The working version (using the old version of krpano): https://cdn.3dcloud.io/kr-pano-bug-demo/working/index.html
And the non-working version (using the new version of krpano): https://cdn.3dcloud.io/kr-pano-bug-demo/…king/index.html

6

Friday, June 2nd 2023, 9:16am

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,
Klaus

7

Monday, June 5th 2023, 3:51pm

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:

Source code

1
module.exports = krpanoJS;


Then, in my TS I changed my import to:

Source code

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



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

Source code

1
(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!