trouble with calling onloadcomplete()

  • Hello to all,

    I have a website that recently stopped working. The viewer krpano 1.20.9 (build 2020-11-19) is used there. Strictly speaking, the event onloadcomplete is no longer executed. Also no error message appears. The panorama is loaded correctly, but all other operations triggered by onloadcomplete are no longer executed.


    So far I have used the following code:
    Inside the HTML5


    Code
    <script>var krpano<?= $this->contentId ?> = new MyKrpanoWrapperClass();  // this is resolved to krpano5896 etc to build an unique variableembedpano(  {    xml:    "{{env::url}}/<?= $this->panoUri ?>",    target: "pano_<?= $this->contentId ?>",    html5:  "auto",    mobilescale:1.0,    consolelog: !0,    passQueryParameters: true,    initvars: {      viewerDir: '<?= $this->viewerDir; ?>',      pluginsDir: '<?= $this->pluginsDir; ?>',      skinDir: '<?= $this->skinDir; ?>'},    onready: krpano_onready_callback});function krpano_onready_callback(_interface) {  krpano<?= $this->contentId ?>.interface = _interface;  krpano<?= $this->contentId ?>.setLookTo(<?= $this->hlookat ?>,<?= $this->vlookat ?>,<?= $this->fov ?>);}<script>

    The wrapper class (will be loaded separately) looks like this:

    Code
    class MyKrpanoWrapperClass{    /********************************************     *     * @param panoramaId     * @param opt     */    constructor(panoramaId, opt = {}) {        this.ifc            = null;  // the krpano interface        this.target         = document.currentScript.parentElement; // the parent el of the embedded script        // more code ...    }    set interface(krpano_interface) {        this.ifc = krpano_interface;        // get path references        this.viewerDir = this.ifc.get('viewerDir');        this.pluginsDir = this.ifc.get('pluginsDir');        this.skinDir = this.ifc.get('skinDir');        // set callback immediately after initialization         this.ifc.set("events.onloadcomplete", this.onLoadComplete.bind(this));    }onLoadComplete() {    alert("ready");   } }

    Recently, onloadcomplete is no longer running. I cannot find a cause. There are no error messages.

    Does anyone have any suggestions??
    Best regards Christian

    Edited 2 times, last by mette (March 18, 2022 at 1:00 PM).

  • i have now reduced the context to the following krpano_onready_callback:

    Code
    function krpano_onready_callback(_interface) { 
    _interface.set("events.onloadcomplete", function() {	alert("onloadcomplete() was triggered");});
    }


    But in the code above onloadcomplete is never triggered.

    But this works well!

    Code
    _interface.set("events.onloadcomplete", alert("onloadcomplete() was triggered"));


    Is anyone aware of side effects that can trigger this behavior?

  • thank you very much for your reply!
    unfortunately everything remains unchanged. The callback onloadcomplete is no longer executed.

    I am at a loss
    EDIT:
    I have found a cause: replacing " with ' brings the solution.

    Code
    _interface.set('events[myevent].onloadcomplete', function() { console.log("onloadcomplete"); });
    _interface.set('events[myevent].keep', true);

    Edited once, last by mette (March 21, 2022 at 8:42 AM).

Participate now!

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