2021-04-28 16:49:39 +02:00

17 lines
515 B
Plaintext

When using the Backbone.js framework, the internal hash containing the model's state, ``++model.attributes++``, should not be accessed directly. Doing so bypasses the listeners set on the model and could put your application in a bad state.
Instead, you should use ``++set++`` to update, ``++get++`` to read, and ``++_.clone(model.attributes)++`` to obtain a copy.
== Noncompliant Code Example
----
myModel.attributes.someAttribute = 1;
----
== Compliant Solution
----
myModel.set({ someAttribute: 1 });
----