@cometchat/chat-uikit-react-native
Version:
Ready-to-use Chat UI Components for React Native
23 lines • 802 B
JavaScript
import { MessageDataSource } from "./MessageDataSource";
class ChatConfigurator {
static dataSource = new MessageDataSource();
static names = ["message_utils"];
static init(initialSource) {
this.dataSource = initialSource ?? new MessageDataSource();
this.names = ["message_utils"];
this.names.push(this.dataSource.getId());
}
static enable(fun) {
let oldSource = this.dataSource;
let newSource = fun(oldSource);
if (!this.names.find((nm) => nm == newSource.getId())) {
this.dataSource = newSource;
this.names.push(this.dataSource.getId());
}
}
static getDataSource() {
return ChatConfigurator.dataSource;
}
}
export { ChatConfigurator };
//# sourceMappingURL=ChatConfigurator.js.map