-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receive broadcast data from external barcode scanner #67
Comments
Hi @JustonJ99 I need more details.
|
I think I get the same error ("its not working with external reader") My Code:
Broadcasted data is: {data: "25C6AE3E", secondaryData: null, type: "#41", typeExt: "HiTag1/S"} |
Hi @kmitdebus thanks for sharing infos, I'll investigate as soon as possible |
I get the same error too, i find the issue in js code: Broadcaster.prototype.fireEvent = function (type, data) {
if (!this._channelExists(type))
return;
var event = document.createEvent('Event');
event.initEvent(type, false, false);
if (data) {
for (var i in data) {
if (data.hasOwnProperty(i)) {
event[i] = data[i];
//^^^ will error when key is "type", "type" in event object is readonly
}
}
}
this._channelFire(event);
}; to fix that, special handling key "type" to another |
Hi @lgl017 thanks for valuable feedback Now there is another issue .... what's the best way to handle such problem:
I prefer the n. 2 what do you think ? |
for backward compatibility copy the data's properties to Event skipping the ones already present in Event itself solve #67
I've updated the Broadcaster.prototype.fireEvent = function (type, data) {
if (!this._channelExists(type))
return;
var event = new Event(type, { bubbles: false, cancelable: false });
if (data) {
event['data$'] = data; // fix issue #67
// for backward compatibility
for (var i in data) {
if (data.hasOwnProperty(i) && event[i] === undefined) {
event[i] = data[i];
}
}
}
this._channelFire(event);
} The solution is to store the given // in the listener
var listener = function( e ) {
console.log( "type: ", e.data$.type );
}
|
enforce property uniqueness update #67
fix released in |
Hi, is it possible to retrieve the data globally (because i have many input from the pages) when a hardware scanner captured the barcode? I have tested the sample code from the documentation but it does not work.
The text was updated successfully, but these errors were encountered: