R
R
roman99662016-04-25 22:31:56
JavaScript
roman9966, 2016-04-25 22:31:56

How to track where the model changes from in backbone.js?

An event hangs on the View that tracks a change in the model, or rather one of the fields of the model. When this field is changed, the event occurs, but not once, as we would like, but twice. How can you track the moment at which this field changes again?
Listener code:

updateCallState: function () {
                    var call_state = this.model.get('call_state');

                    if (call_state == "call in progress") {
                        this.startDate = new Date();
                        this.started = true;
                        this.startTime();
                    } else if (call_state == "disconnected") {
                        this.started = false;
                        this.saveMessage();
                        this.$el.remove();

                        return;
                    } else {
                        this.$el.find('.call_state').html(call_state);
                    }

                    this.render();
                },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2016-04-25
@k12th

Set a breakpoint and see the stack: https://developer.chrome.com/devtools/docs/javascr...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question