Auto save diagram excluding management operations


I would like to auto save my diagram,
so in order to know if there was a change I am listen to modelChangeEventListener

then I can do this
let txn = event.object;
if (txn != null)
time to save

But I get to here in cases that a lot of thing changes such as when I disable the diagram (I get that property point is changed)

how can I know that only operation on nodes and links were done?



Yes I read about this
I tried this
if (event.isTransactionFinished) {
console.log(“transaction finish”);
let txn = event.object;
if (txn != null) {
time to save …

but if I do also something like this in my app
this.diagram.commit(() => {
this.diagram.isEnabled = true / false;

then I also get the information that transaction was ended

but in this case I do not want to save.


I thought that the isEnabled causing a transaction of with points property change,
but it turned out that this is related to the links,
it happened that when i just started the model i got points change
I am not sure why i get this

anyway I can filter the known properties like isEnabled and points,

the only problem I have , is why I get points change when I just load the model

so my code look like this

        if (event.isTransactionFinished) {
        let txn = event.object;
        if (txn != null) {
            let firstChange = txn.changes
                .filter((evt) => {
                    return evt.propertyName != "points" &&
                        evt.propertyName != "enabled"
            if (firstChange) {
               time to save


what do you think?


If you only want to do something if there have been changes to the model, you could see if there are any ChangedEvents that have ChangedEvent.model equal to the model that you care about.