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"