From cfcdd51cc21e516e436c576b013f1a216c7d7aed Mon Sep 17 00:00:00 2001 From: Lcterry Date: Wed, 13 Sep 2023 15:49:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E5=8F=B73.?= =?UTF-8?q?0.4=20+=20=E6=9A=B4=E9=9C=B2CommandEvent=20=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/package.json | 2 +- index.js | 8 ++++++++ package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/example/package.json b/example/package.json index 39eb5f7..e4bb1b0 100644 --- a/example/package.json +++ b/example/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "jcore-react-native": "2.1.3", - "jpush-react-native": "3.0.3", + "jpush-react-native": "3.0.4", "react": "16.8.6", "react-native": "0.60.5", "update": "^0.7.4" diff --git a/index.js b/index.js index 4a08f6e..81f4100 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ const CustomMessageEvent = 'CustomMessageEvent' //自定义消息事件 const InappMessageEvent = 'InappMessageEvent' //应用内消息事件 const TagAliasEvent = 'TagAliasEvent' //TagAlias/Pros事件 const MobileNumberEvent = 'MobileNumberEvent' //电话号码事件 +const CommandEvent = 'CommandEvent' //COMMAND事件 export default class JPush { @@ -433,6 +434,13 @@ export default class JPush { callback(result) }) } + //CommandEvent 事件回调 + static addCommandEventListener(callback) { + listeners[callback] = DeviceEventEmitter.addListener( + CommandEvent, result => { + callback(result) + }) + } /* * 通知事件 diff --git a/package.json b/package.json index 94f7150..1dfa8de 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "index.d.ts", "license": "ISC", "author": "wicked.tc130", - "version": "3.0.3", + "version": "3.0.4", "repository": { "type": "git", "url": "https://github.com/jpush/jpush-react-native"