Integration into parcel bundler

  • Hello,
    I'm trying to embed the pano viewer into an existing project which is based on the parcel bundler. When i just load an additional script via the index.html, the embedpano function can not be found (Uncaught ReferenceError: embedpano is not defined).
    Does anyone know how to manage this? *confused* Any help is greatly appreciated!
    Sebastian

    Edited once, last by swalter (September 15, 2022 at 6:28 PM).

  • You need to call the embedpano function after the krpano script is loaded.
    As it's done in the krpano default html synchronously or use load event if you load script dynamically.

  • Thanks for your reply. The problem with this method is that the krpano is then loaded in separately, so in the other scripts of my site I can not access the krpano object and its functions. I want to interactively switch on/off panoramas using different buttons than the ones offered in the viewer, for example.

  • You can acces krpano object like this

    Code
    const krpano = document.getElementById('krpanoSWFObject').get('global');


    Where krpanoSWFObject is the id that you pass to the embedpano

    Code
    embedpano({ id:"krpanoSWFObject"....})
  • This does not work. The javascript is not loaded correctly. Here is an example:

    index.html:


    index.js:


    package.json:


    Error message:

    Quote

    document.getElementById(...).get is not a function


    Live Sandbox: https://codesandbox.io/s/angry-varaha…kage.json:0-455

Participate now!

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