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!

    Edited once, last by webseta (September 27, 2019 at 5:47 AM).

  • 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.

  • after some testing looks like in the onReady callback sometimes the object is of the first type, and sometimes the other.

    Definitively not! *wink*
    Please check that again.


    Quote

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


    Yes, e.g. do:

    Code
    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

Participate now!

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