Created
May 18, 2015 21:53
-
-
Save alistair/626b9a28bf06eaa4646d to your computer and use it in GitHub Desktop.
Backbone post update convention
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http_conventions.js | |
| var Backbone = require('Backbone'); | |
| var postOnUpdate = function(method, model, options) { | |
| return Backbone.sync('create', model, options); | |
| } | |
| var postOnGet = // whatever here | |
| export.postOnUpdate = postOnUpdate; | |
| export.postOnGet = postOnGet; | |
| // whatever other conventions you need. | |
| // Question.js | |
| var Conventions = require('http_conventions'); | |
| export = Backbone.Model.extend({ | |
| sync: Conventions.postOnUpdate, | |
| ..... | |
| ..... | |
| ..... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment