Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function setupDirtyWatcher(viewModel: DataViewModel) {
const dispose = deepObserve(viewModel, (change, path) => {
viewModel.isDirty = true
dispose()
})
}
if (!project) {
return;
}
if (
projectSync.id &&
projectSync.id !== project.getId() &&
typeof projectSync.stop === 'function'
) {
projectSync.stop();
projectSync.id = undefined;
}
if (!projectSync.id) {
projectSync.stop = MobxUtils.deepObserve(project, onProjectChange(app));
projectSync.id = project.getId();
}
},
{
Mobx.autorun(() => {
const project = store.getProject();
if (typeof stopProjectSync === 'function') {
stopProjectSync();
}
stopProjectSync = MobxUtils.deepObserve(project, onProjectChange(app));
});
() => {
const app = store.getApp();
if (!app) {
return;
}
if (appSync.id && appSync.id !== app.getId() && typeof appSync.stop === 'function') {
appSync.stop();
appSync.id = undefined;
}
if (!appSync.id) {
appSync.stop = MobxUtils.deepObserve>(
app,
onAppChange(app)
);
appSync.id = app.getId();
}
},
{
Mobx.autorun(() => {
const app = store.getApp();
if (typeof stopAppSync === 'function') {
stopAppSync();
}
stopAppSync = MobxUtils.deepObserve(app, onAppChange(app));
});
}