Guest User

Untitled

a guest
Jun 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Backbone.sync.parsers({
  2. MyDocumentsModel: {
  3. url: "/documents",
  4. parse: function(response){
  5. return response.documents;
  6. }
  7. },
  8. ...
  9. });
  10.  
  11. // actually, this would probably be a better idea so we don't get such a high level of cohesion between names and strings...
  12.  
  13. Backbone.sync.parsers[MyDocumentsModel] = {
  14. url: "/documents",
  15. parse: function(response){ return response.documents; }
  16. }
  17.  
  18. Backbone.sync.parsers[MyTags] = {
  19. url: "/documents",
  20. parse: function(response){ return _.map(response.documents, function(d){ return d.tags }); }
  21. }
Add Comment
Please, Sign In to add comment