Skip to content

Instantly share code, notes, and snippets.

@yushulx
Created August 6, 2020 08:24
Show Gist options
  • Save yushulx/475a7f7714e3d80184f824a4e47ecc25 to your computer and use it in GitHub Desktop.
Save yushulx/475a7f7714e3d80184f824a4e47ecc25 to your computer and use it in GitHub Desktop.
handleClick() {
if (DWObject) {
let image = this.shadowRoot.querySelector('#image');
DWObject.SelectSource(function () {
var onSuccess, onFailure;
onSuccess = onFailure = function () {
DWObject.CloseSource();
image.src = DWObject.GetImageURL(DWObject.CurrentImageIndexInBuffer, 640, 480);
};
DWObject.OpenSource();
DWObject.IfDisableSourceAfterAcquire = true;
DWObject.AcquireImage(onSuccess, onFailure);
}, function () {
console.log('SelectSource failed!');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment