@appscode/ui-builder
Version:
## Motivation
31 lines (24 loc) • 704 B
JavaScript
export function initializeSubjects({
getValue,
commit,
model,
reusableElementCtx,
watchDependency,
}) {
const { dataContext } = reusableElementCtx || {};
const school = getValue(dataContext, "/schoolName");
watchDependency("data#/schoolName");
const subjects = getValue(model, "/") || [];
subjects.push(school);
commit("wizard/model$update", {
path: "/",
value: subjects,
force: true,
});
}
export function onSubjectsChange({ reusableElementCtx, model, getValue }) {
const { functionCallbacks } = reusableElementCtx || {};
const { updateStudentName } = functionCallbacks || {};
const subjects = getValue(model, "/");
updateStudentName(subjects.pop());
}