You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, September 27th 2019, 5:13am

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!

This post has been edited 1 times, last edit by "webseta" (Sep 27th 2019, 5:47am)


2

Friday, September 27th 2019, 11:04am

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

Friday, September 27th 2019, 11:40am

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

4

Friday, September 27th 2019, 11:57am

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.


Quoted

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

Yes, e.g. do:

Source code

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

Saturday, September 28th 2019, 4:50pm

That's it! Thanks a lot :)