You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am rather new to Backbone and Backbone.Memento and perhaps there is a better way to do what I want to do.
I am writing a view that binds to the model's change event. I want it to have a slightly different behavior if the change came from a set or a restore (which calls set).
Right now, I have hacked on a setOptions config entry in the main config that gets passed to the Serializer. I modified the restore method on the TypeHelper to pass those setOptions when it calls structure.set. The Serializer passes these options in when it calls typeHelper.restore. I can set the setOptions config at instantiation or when I restore my model.
So I guess my question is, are there ways of doing this that already exist or are there better ways of doing it? If not, is this something that you think other people would want to use or worth sticking into Memento? If so, I can and the code to the issue so you can merge it in.
I'm not sure if setOptions is a great name, considering it could be passed to Model.unset or Collection.remove or Collection.reset.
Thanks for Memento, btw, it makes for some cool things.
The text was updated successfully, but these errors were encountered:
I am rather new to Backbone and Backbone.Memento and perhaps there is a better way to do what I want to do.
I am writing a view that binds to the model's change event. I want it to have a slightly different behavior if the change came from a set or a restore (which calls set).
Right now, I have hacked on a
setOptions
config entry in the main config that gets passed to the Serializer. I modified the restore method on the TypeHelper to pass thosesetOptions
when it callsstructure.set
. The Serializer passes these options in when it callstypeHelper.restore
. I can set thesetOptions
config at instantiation or when Irestore
my model.My model looks something like this:
And my view's doChange method can now check the options passed to it:
So I guess my question is, are there ways of doing this that already exist or are there better ways of doing it? If not, is this something that you think other people would want to use or worth sticking into Memento? If so, I can and the code to the issue so you can merge it in.
I'm not sure if
setOptions
is a great name, considering it could be passed toModel.unset
orCollection.remove
orCollection.reset
.Thanks for Memento, btw, it makes for some cool things.
The text was updated successfully, but these errors were encountered: