I have some complex screen in my Aurelia app and I would like to check easily if some bindings are dirty checked. I can add console.log in all my property getter and check when it is called but it's not easy.
Ideally I would like to get in the console the observer strategy used by each binding, but I didn't find where to plug to add this log.
Thanks
if you want to see if the form is dirty you should check the viewModel in kendo way sample. basically I've created a viewModel which is impements the ObservableObject interface and has a two way binding with the form's container.
Dirty checking is a simple process that boils down to a very basic concept: It checks whether a value has changed that hasn't yet been synchronized across the app. Our Angular app keeps track of the values of the current watches.
A solution to this problem is to change the default configuration of FlushMode from auto to manual by setting FlushMode. MANUAL . In this way the dirty check mechanism will stop causing the aforementioned synchronization. Although the Session is only ever flushed when Session.
It is simple-- when you load/get entity object by id and then set its new field values by setter method and close session without calling update() method. then hibernate automatically update the changed value in the table without affecting other fields. and at the same time entity object is in dirty state.
You can override DirtyCheckProperty
's subscribe method to add logging:
import {DirtyCheckProperty} from 'aurelia-binding';
import * as LogManager from 'aurelia-logging';
const logger = LogManager.getLogger('my-app');
DirtyCheckProperty.prototype.standardSubscribe = DirtyCheckProperty.prototype.subscribe;
DirtyCheckProperty.prototype.subscribe = function(context, callable) {
this.standardSubscribe(context, callable);
logger.warn(`'${this.obj.constructor.name}.${this.propertyName}' is being dirty checked`, this.obj);
}
The messages would look like this in the console:
Here's a running example app:
https://gist.run/?id=2c863d48a2a711b8c5f93df2bb7c4a3b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With