@toloka-dev/tbx-external-field-client
Version:
Library designed to facilitate communication and configuration management between TBX and an external app
27 lines (24 loc) • 963 B
JavaScript
import '../node_modules/.pnpm/penpal@6.2.2/node_modules/penpal/lib/enums.js';
import connectToParent from '../node_modules/.pnpm/penpal@6.2.2/node_modules/penpal/lib/child/connectToParent.js';
const createFieldExternalConnection = (options) => {
return connectToParent({
methods: {
onChangeConfig: (changedConfig) => {
if (typeof options.onChangeConfig === 'function') {
options.onChangeConfig(changedConfig);
}
},
onChangeValue: (changedValue) => {
if (typeof options.onChangeValue === 'function') {
options.onChangeValue(changedValue);
}
},
onChangeTheme: (theme) => {
if (typeof options.onChangeTheme === 'function') {
options.onChangeTheme(theme);
}
},
},
});
};
export { createFieldExternalConnection };