Last active
December 19, 2015 19:09
-
-
Save danielevans/6004317 to your computer and use it in GitHub Desktop.
Demonstrate CoffeeScript's super method in Backbone
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
class TestModel extends Backbone.Model | |
toJSON: -> | |
_.extend super, | |
success: true | |
json = (new TestModel(test: "success")).toJSON() | |
throw "no super data" unless json.test == "success" | |
throw "no child data" unless json.success == true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment