Skip to content

Commit c6ef745

Browse files
committed
Merge branch 'release/5.2.0'
2 parents 45e779b + de28a67 commit c6ef745

File tree

6 files changed

+26
-19
lines changed

6 files changed

+26
-19
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Android | **[LocalBroadcastManager](http://developer.android.com/reference/andro
1717
## News
1818
date | infos | refs
1919
---- | ---- | ----
20+
May 11, 2024 | fix [#67](https://github.com/bsorrentino/cordova-broadcaster/issues/67) - Receive broadcast data from external barcode scanner | Thanks to [lgl017](https://github.com/lgl017) and [kmitdebus](https://github.com/kmitdebus) for valuable feedbacks
2021
Jul 19, 2023 | fix [#71](https://github.com/bsorrentino/cordova-broadcaster/pull/71) - Cannot find symbol "LocalBroadcastManager" | Thanks to [MrWeezle](https://github.com/MrWeezle) for valuable feedbacks
2122
Jul 14, 2023 | Merge pull request [#70](https://github.com/bsorrentino/cordova-broadcaster/pull/70) - move to SDK 33 --> Android X. | Thank to [phyr0s](https://github.com/phyr0s) for contribution
2223
Mar 19, 2020 | Concerning **Android** I've added support for **broadcast Intent to external Apps**, **receive broadcast Intents from external Apps**, **Flags & Category on Intent** | insipred by [navarrojava's fork](https://github.com/navarrojava/cordova-broadcaster/)

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-plugin-broadcaster",
3-
"version": "5.1.0",
3+
"version": "5.2.0",
44
"description": "Allow send message from Javascript to Native",
55
"cordova": {
66
"id": "cordova-plugin-broadcaster",
@@ -26,7 +26,7 @@
2626
"2.3.0": {
2727
"cordova-android": ">4.0.0"
2828
},
29-
"5.1.0": {
29+
"5.2.0": {
3030
"cordova-android": ">9.0.0"
3131
}
3232
}
@@ -39,9 +39,9 @@
3939
"homepage": "https://github.com/bsorrentino/cordova-broadcaster#readme",
4040
"devDependencies": {
4141
"@types/cordova": "0.0.34",
42-
"@types/node": "^13.9.2",
43-
"auto-changelog": "^2.4.0",
44-
"typescript": "^3.8.3"
42+
"@types/node": "13.9.2",
43+
"auto-changelog": "2.4.0",
44+
"typescript": "3.8.3"
4545
},
4646
"scripts": {
4747
"changelog": "auto-changelog -u",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<plugin id="cordova-plugin-broadcaster"
3-
version="5.1.0"
3+
version="5.2.0"
44
xmlns="http://apache.org/cordova/ns/plugins/1.0"
55
xmlns:android="http://schemas.android.com/apk/res/android">
66
<engines>

www/broadcaster.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,14 @@ var Broadcaster = /** @class */ (function () {
7575
Broadcaster.prototype.fireEvent = function (type, data) {
7676
if (!this._channelExists(type))
7777
return;
78-
var event = document.createEvent('Event');
79-
event.initEvent(type, false, false);
78+
// const event = document.createEvent('Event');
79+
// event.initEvent(type, false, false);
80+
var event = new Event(type, { bubbles: false, cancelable: false });
8081
if (data) {
82+
event['data$'] = data; // fix #67
83+
// for backward compatibility
8184
for (var i in data) {
82-
if (data.hasOwnProperty(i)) {
85+
if (data.hasOwnProperty(i) && event[i] === undefined) {
8386
event[i] = data[i];
8487
}
8588
}

www/broadcaster.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,15 @@ class Broadcaster {
106106
{
107107
if( !this._channelExists(type) ) return;
108108

109-
const event = document.createEvent('Event');
110-
event.initEvent(type, false, false);
109+
// const event = document.createEvent('Event');
110+
// event.initEvent(type, false, false);
111+
const event:any = new Event( type, { bubbles: false, cancelable: false})
111112
if (data) {
113+
event['data$'] = data // fix #67
114+
// for backward compatibility
112115
for (var i in data) {
113-
if (data.hasOwnProperty(i)) {
114-
(<any>event)[i] = (<any>data)[i];
116+
if (data.hasOwnProperty(i) && event[i] === undefined ) {
117+
event[i] = (<any>data)[i];
115118
}
116119
}
117120
}

0 commit comments

Comments
 (0)