We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Question about createApp() function

Home Forums Programming Question about createApp() function

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #70451
    David Duperron
    Customer

    Hi!
    I have put in place a solution to secure and user-customize the access to my web application using a Firebase realtime database. Basically it is waiting for the user to properly log in to launch the createApp() function which is located in the app.js file.
    I have replaced the “load” eventlistener by a function which is triggered when the user is logged in. This is working perfectly for the web app, but this is causing the puzzles editing page to not load!
    Is there a way to have a different behaviour to launch the createApp() function for the web app page and for the puzzles page??
    Thanks for the help!

    David

    #70452
    kdv
    Participant

    just use different app_name.js files for the Puzzle editor and on your web server.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #70454
    David Duperron
    Customer

    Ok but how?? the puzzle button in the app manager is linking to the app_name.html file, with the visual_logic.xml file as a parameter, and the .js file is called inside the app_name.html file… I don’t see how to make it different for the puzzle editor and the web server.

    #70455
    kdv
    Participant

    Make changes in .js, upload it to your web server. Remove changes to use in the Puzzles editor. Do not upload it any more.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #70461
    kdv
    Participant

    Or you can check if the Puzzles editor is used

    window.addEventListener('load', (e) => {
        const params = v3d.AppUtils.getPageParams();
        if (params.logic) { // check if the Puzzles editor is used
            createApp({
                containerId: 'v3d-container',
                fsButtonId: 'fullscreen-button',
                sceneURL: params.load || 'bloom_test.gltf',
                logicURL: params.logic || 'visual_logic.js'
            });
        } else {
            // do whatever you want here
        }
    });

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #70479
    David Duperron
    Customer

    Thanks§ that works perfectly

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.