Comments (5)
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 onConfigure
and addlocalhost:9222
in the Target discovery settings popup
-- All discoverable pages should now be displayed (may take a few seconds/minutes)
-- Clickinspect
under the extension you are about to debug to launch its remote debugging page
from xjs.
The only issue I see you can get here is when tempHtml
variable is not declared
from xjs.
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?
from xjs.
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.
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)
- Issues with case sensitive matching HOT 1
- Allow `duplicate` item calls to return UIDs of newly added sources
- Expose method to refresh source on show and on scene enter
- Fix documentation
- OnAsyncCallback should handle more than two parameters
- Typescript type definitions HOT 1
- Ability to copy presets
- Provide event callbacks for presets
- How to get source id for item HOT 5
- Set 'play on source show' on media items HOT 1
- Bug ActionAfterPlayback; wrong constants HOT 1
- Bug: isVideo returns false on looping videos
- getPlaybackDuration only works for active scene HOT 1
- Race condition for isVisible (and possibly more checks) HOT 1
- from php script i want to change dynamically source media HOT 3
- Apply new audio changes to XJS HOT 2
- Xsplit Broadcaster extension store
- Stream and recording start/stop event notification HOT 4
- Which kind of format must be? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xjs.