Skip to content

Commit a66b631

Browse files
committed
Added partial onChange callback (with only String key) for back-compat and simplicity
1 parent be23994 commit a66b631

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/CloudStorage.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <functional>
1010

1111
typedef std::function<void(String, AnyValue&)> KeyChangedCallback;
12+
typedef std::function<void(String)> KeyChangedCallbackPartial;
13+
1214
enum PopFrom {
1315
PopFrom_Start,
1416
PopFrom_End
@@ -46,6 +48,12 @@ class BaseCloudStorage {
4648
void onChange(KeyChangedCallback callback) {
4749
this->_listenCallback = callback;
4850
}
51+
52+
void onChange(KeyChangedCallbackPartial callback) {
53+
this->_listenCallback = [&callback](String key, AnyValue& value){
54+
callback(key);
55+
};
56+
}
4957

5058
bool isListeningForUpdates() {
5159
return client.available() && this->_connectionState == WS_STATE_CONNECTED;

0 commit comments

Comments
 (0)