admin管理员组文章数量:1297093
I have android mobile application created with sencha Ext JS framework, JavaScript and Cordova library. This app will only run in the PDA device(Point Mobile PM85) and PDA device have inbuild scanning button function to scan any barcode and return the value.
My issue is with continue scanning function in PDA device on long press inbuild scan button. If we do long press scan button it will scan the barcode and return the data. The data will display in input field. After long press scan button scan function works but it is calling the previous or any active page automatically without calling to the current page.
Scan function calling using the Cordova barcode scan plugin (Cordova-plugin-point-mobile).
I have tried to remove the last page after navigate to current page. But having the same issue. And we can't use the destroy method to remove the last page because in some case we are using the data transfer one page to another page.
Below code are using to scan the barcode-
When page will enter scan function is active for scanning. After press the barcode scan button below code will execute and return the value.
Current page scan function-
function(){
const barcode = function (event) {
if (event.keyCode == '0') { // scan function event code in PDA scan button after press the scan button
const pointMobile = window.cordova.plugins.pointmobile;
pointMobile.scan(
data => {
object = { barcode: data.barcode.trim() };
searchfield.setValue(object.barcode);
},
error => {
console.log('barcode scan error');
},
);
}
}
document.addEventListener("keydown", barcode, false); // Cordova call to scan event listener
}
Last page scan function-
This function auto call without invoking it.
function(){
const barcode = function (event) {
if (event.keyCode == '0') { // scan function event code in PDA scan button after press the scan button
const pointMobile = window.cordova.plugins.pointmobile;
pointMobile.scan(
data => {
object = { barcode: data.barcode.trim() };
searchfield.setValue(object.barcode);
},
error => {
console.log('barcode scan error');
},
);
}
}
document.addEventListener("keydown", barcode, false); // cordova call to scan event listener
}
All the page have same code and same issue.
Kindly help and check why scan function calling to another function without invoking it.
本文标签: javascriptIssue with navigation always taking previous and current page as activeStack Overflow
版权声明:本文标题:javascript - Issue with navigation always taking previous and current page as active - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741618224a2388655.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论