From 96c68750e9136409fe4f49789c3b61f3c5f2a887 Mon Sep 17 00:00:00 2001 From: ilcato Date: Tue, 25 Jun 2019 16:24:29 +0200 Subject: [PATCH] Added method for removing property value callback --- src/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/index.js b/src/index.js index 8d42e8d..01311a0 100644 --- a/src/index.js +++ b/src/index.js @@ -616,6 +616,16 @@ const onPropertyValue = (thingId, name, cb) => { return Promise.resolve(propOutputTopic); }; +const removePropertyValueCallback = (thingId, name) => { + if (!name) { + throw new Error('Invalid property name'); + } + const propOutputTopic = `/a/t/${thingId}/e/o`; + delete propertyCallback[propOutputTopic][name]; + return Promise.resolve(propOutputTopic); +}; + + export default { connect, disconnect, @@ -629,6 +639,7 @@ export default { sendProperty, sendPropertyAsDevice, onPropertyValue, + removePropertyValueCallback, getCborValue, getSenml, ArduinoCloudError,