Sie sind nicht angemeldet.

1

Freitag, 27. September 2019, 05:13

krpano interface object (via onready vs registerplugin)

Dear Klaus!

When the krpano interface object is referenced from inside a registerplugin call, it's a bit different, as variables and certain methods can be accessed directly, like krpano.myvar (defined in the initvars for example). However when referenced from the onReady callback, it's necessary to use the call/get/set etc. methods.

Is it possible to get the first type of interface object without setting up a plugin, and defining the registerplugin method?

EDIT: after some testing looks like in the onReady callback sometimes the object is of the first type, and sometimes the other. I assume it depends on how fast or in what order some things play out in real time when the page loads, but would be nice if you could shed some light on this to know for sure.

Thanks!

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »webseta« (27. September 2019, 05:47)


2

Freitag, 27. September 2019, 11:04

As stated in the docs, in onready callback you get krpano Javascript-Interface object (where you need to use get, set, call).
Inside the plugin you get The krpano Interface Object - this object provides access to interfacing functions and to the whole krpano data structure.

3

Freitag, 27. September 2019, 11:40

So then the question is, is it possible to get the KIO somehow from the JIO? :)

4

Freitag, 27. September 2019, 11:57

after some testing looks like in the onReady callback sometimes the object is of the first type, and sometimes the other.
Definitively not! ;-)
Please check that again.


Zitat

is it possible to get the KIO somehow from the JIO? :)

Yes, e.g. do:

Quellcode

1
krpano = krpano.get("global");

The global object refers to the 'root' krpano scope where all variables, functions and so are stored. This is the same as the 'krpano Interface Object'.

Best regards,
Klaus

5

Samstag, 28. September 2019, 16:50

That's it! Thanks a lot :)