Guest User

Untitled

a guest
Jan 12th, 2019
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class App.Models.RevertingModel extends Backbone.Model
  2.     mark: ->
  3.         @_revertAttributes = _.clone @attributes
  4.  
  5.     revert: ->
  6.         @set(@_revertAttributes) if @_revertAttributes
  7.  
  8.     sync: (method, model, options) ->
  9.         success = options.success
  10.  
  11.         options.success = (resp, status, xhr) =>
  12.             success(resp, status, xhr) if success
  13.             @mark()
  14.  
  15.         Backbone.sync(method, model, options)
Add Comment
Please, Sign In to add comment