Giter Site home page Giter Site logo

Unable to get name of Scenes about xjs HOT 5 CLOSED

ToddInIowa avatar ToddInIowa commented on August 17, 2024
Unable to get name of Scenes

from xjs.

Comments (5)

SML-MeSo avatar SML-MeSo commented on August 17, 2024 1

Good catch there, @jvens :) Failed to think of that possibility without the full code snippet.

As a reference, the framework has been developed before async-await became a thing and using promises is the go-to functionality for asynchronous methods and this is reflected in the xjs framework support website. I believe that most, if not all, of the snippets in the website still stay true though it can use a fresher update.

For debugging, latest chrome now again has support:

  • open the settings window through Tools > Settings. At the Settings window, click the Advanced tab, then check Enable developer mode
  • in chrome, open chrome://inspect/#devices
    -- click on Configure and add localhost:9222 in the Target discovery settings popup
    -- All discoverable pages should now be displayed (may take a few seconds/minutes)
    -- Click inspect under the extension you are about to debug to launch its remote debugging page

from xjs.

marloeleven avatar marloeleven commented on August 17, 2024

The only issue I see you can get here is when tempHtml variable is not declared

from xjs.

SML-MeSo avatar SML-MeSo commented on August 17, 2024

A few questions on your usage, as I've rechecked it and the functionality should still be working on latest public XBC and xjs 2.10.2 (as shown in screenshot below)

  • What are the versions of XBC and XJS framework you are using (just to be sure, but as far as I can remember, all versions of xjs should work for public versions of XBC) ?
  • Are you using the remote debugger feature when developing? If yes, are there no javascript errors present?

image

from xjs.

jvens avatar jvens commented on August 17, 2024

The issue with this is attempting to use tempHtml outside of the promise before the promise had been resolved. For a bit more context the usage was

var tempHtml = "some valid HTML"
// ...
xjs.Scene.getBySceneIndex(0).then(function(focusscene) {
    focusscene.getName().then(function(name) {
        tempHtml += name;
     });
});
// ...
tempHtml += "other HTML"
document.getElementById(id).innerHTML = tempHtml;

Fixing the logic and using await to get the name fixes the problem.

from xjs.

ToddInIowa avatar ToddInIowa commented on August 17, 2024

I am using:
XSplit Broadcaster v4.4(4.4.2211.0404)
xjs version 2.10.2

I have not been able to get the remote debugger to work. So I have used Chrome to debug the portions of my code that don't need xjs, and then fly blind for the xjs stuff. Is there any documentation on how to use the debugger with more detail than "please try using lower versions via CEF builds or the like."

As mentioned above @jvens swapped around my logic and used async calls instead of promises to resolve my issue:

let scene = await xjs.Scene.getBySceneIndex(0);
var tempHtml = "some valid HTML"
// ...
tempHtml += await scene.getName();
tempHtml += "other HTML"
document.getElementById(id).innerHTML = tempHtml;

The promise concept is not one that I am familiar with so I didn't realize I needed to keep everything contained.

from xjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.