var barcodeNum = ko.observable("");
VelocityMeetings.scan = function (params) {
var errorMessage = ko.observable("");
var viewModel = {
errorMessage: errorMessage,
scannumber: ko.observable(""),
errorVisible: ko.computed(function() {
return errorMessage().length != 0;
}),
scanBarcode: function() {
//Capture image with device and process into barcode
capturePhoto();
this.scannumber(barcodeNum());
//this.errorMessage(errMessage);
},
};
return viewModel;
};
我有在視圖模型外部創建的barcodeNum變量,試圖將數據傳回scannumber變量。如何訪問在視圖模型中定義的變量?淘汰賽交叉視圖模型
我們的目標是使用javascript Worker來更新scannumber,它將相應地更新我的應用程序,但我無法使其正常工作。
function receiveMessage(e) {
barcodeNum("Test function");
}
var DecodeWorker = new Worker("js/BarcodeScanner.js");
DecodeWorker.onmessage = receiveMessage;
的目標是沿此
VelocityMeetings.scan.viewModel.scannumber(barcodeNum());
線的東西,但是這個心不是正常