The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/views/omnichannel/additionalForms.js

26 lines
569 B

const createFormSubscription = () => {
let forms = {};
let updateCb = () => {};
const formsSubscription = {
subscribe: (cb) => {
updateCb = cb;
return () => {
updateCb = () => {};
};
},
getCurrentValue: () => forms,
};
const registerForm = (newForm) => {
forms = { ...forms, ...newForm };
updateCb();
};
const unregisterForm = (form) => {
delete forms[form];
updateCb();
};
return { registerForm, unregisterForm, formsSubscription };
};
export const { registerForm, unregisterForm, formsSubscription } = createFormSubscription();