I’ve got a WebHTMLViewer on a dialog named “Uppy1”. In the WebHTMLViewer’s shown event, I am executing Javascript using me.ExecuteJavascript that creates a Javascript object that is part of an open source library. So far everything is working well. I even got a call back to work with a custom WebSDK control that I am placing on the WebDialog.
Here is the Javascript code that is executing to create the object:
var uppy = new Uppy.Core()
.use(Uppy.Dashboard, {
inline: true,
target: '#drag-drop-area',
showLinkToFileUploadResult: false,
disableThumbnailGenerator: true,
showProgressDetails: true,
allowMultipleUploads: false,
hideProgressAfterFinish: false,
height: 400,
width: 400
})
I would like to execute a method on the “uppy” object using Javascript when a Xojo Web Button is clicked. For starters, I am trying something really simple:
Uppy1.ExecuteJavaScript("console.log(uppy.getId())")
Uppy1.ExecuteJavaScript("console.log('testing')")
When I run this, the first statement seems to be ignored and all I get in the console log is “testing”.
I’m guessing it is a scope issue but I have no idea where to start. How do I access the Javascript “uppy” object that I create in the open event of the WebHTMLViewer?