@react-native-agconnect/clouddb
Version:
React Native AGC CloudDB
26 lines (22 loc) • 806 B
JavaScript
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
*/
import { NativeModules } from 'react-native';
const { AGCCloudDBModule } = NativeModules;
import AGCCloudDBException from '@react-native-agconnect/clouddb/src/AGCCloudDBException';
export default class AGCCloudDBListenerHandler {
constructor(zoneId, listenerId, eventListener) {
this.listenerId = listenerId;
this.zoneId = zoneId;
this.eventListener = eventListener;
}
remove() {
return AGCCloudDBModule.removeSubscription(this.zoneId, this.listenerId)
.then(response => {
this.eventListener.remove();
return response;
}).catch(error => {
throw new AGCCloudDBException(error);
});
}
}