You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Adobe git hub examples : pdf-embed-api-samples/Viewer APIs/Search and Zoom APIs/index.js
If the search is done, it must call its callbacks. In this case, "searchCallback". However, this doesn't get called anymore.
It used to call, but at some point it doesn't. Can someone look at this problem?
Actual code looks like this
var search = function(searchTerm) {
viewerApis.search(searchTerm)
.then(function(sObj) {
searchObject = sObj;
searchObject.onResultsUpdate(searchCallback). // ==> This callback doesn't get called.
.then(function(result) {
console.log("Registered callback function with onResultsUpdate(): ", result) // ===> This is always false
})
.catch(function(error) {
console.log(error)
});
})
.catch(function(error) {
var errorMsg = "";
if(error.code === "FAIL") {
errorMsg = "No search result found";
} else if(error.code === "INVALID_INPUT") {
errorMsg = "Enter valid search term";
}
document.getElementById("search-result").style.display = "block";
document.getElementById("searchResult-num").innerText = errorMsg;
document.getElementById("search-result").querySelectorAll(".searchResult-btn").forEach(function(element) {
element.style.opacity = "0.2";
element.disabled = true;
});
})
}
//// CALLBACK. This used to called, but no longer gets called.
function searchCallback(searchResult) {
var currentResultIndex = searchResult.currentResult.index;
var totalResults = searchResult.totalResults;
var searchResultItem = document.getElementById("search-result");
searchResultItem.style.display = "block";
document.getElementById("searchResult-num").innerText = "Result " + currentResultIndex + " of " + totalResults;
searchResultItem.querySelectorAll(".searchResult-btn").forEach(function(element) {
element.style.opacity = "0.8";
element.disabled = false;
});
}
Expected Behaviour
It should make a callback call.
Actual Behaviour
It doesn't make callback.
The text was updated successfully, but these errors were encountered:
Edit: After checking it for a while, it seems that the onResultsUpdate is being invoked, but it fails due to an error that occurs within it.
You can use the .then promise of the onResultsUpdate to confirm it.
The Adobe git hub examples : pdf-embed-api-samples/Viewer APIs/Search and Zoom APIs/index.js
If the search is done, it must call its callbacks. In this case, "searchCallback". However, this doesn't get called anymore.
It used to call, but at some point it doesn't. Can someone look at this problem?
Actual code looks like this
Expected Behaviour
It should make a callback call.
Actual Behaviour
It doesn't make callback.
The text was updated successfully, but these errors were encountered: