Created
October 10, 2017 20:38
-
-
Save scott-w/567d6cd065249f5cf513fe6b2f3ffdbd to your computer and use it in GitHub Desktop.
Custom Model Implementation
This file contains 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
import { Model } from 'backbone'; | |
export const MyModel = Model.extend({ | |
defaults: { | |
counter: 0 | |
}, | |
/** | |
* Increment our counter and return the new value. | |
* @returns {number} The incremented counter | |
*/ | |
increment() { | |
// I'll show our implementation later | |
}, | |
/** | |
* Increment the counter by num and return the new value. | |
* @param {number} num The number to add to the counter. | |
* @returns {number} The counter + num | |
*/ | |
addCounter(num) { | |
// I'll show our implementation later | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment