/src/js-example/collections/commits.js
JavaScript | 28 lines | 13 code | 6 blank | 9 comment | 0 complexity | 40abaf5825975192acb75530f61aaf33 MD5 | raw file
Possible License(s): MIT
- //
- // Collection for GitHub "commits".
- //
- // [Sharify](https://github.com/artsy/sharify) lets us require the API url
- // and Backbone.sync is replaced with a server-side HTTP module in /lib/setup
- // using [Backbone Super Sync](https://github.com/artsy/backbone-super-sync).
- // This combined with [browerify](https://github.com/substack/node-browserify)
- // makes it simple to share this module in the browser and on the server.
- //
- var Backbone = require('backbone'),
- sd = require('sharify').data,
- Commit = require('../models/commit');
- module.exports = Commits = Backbone.Collection.extend({
- model: Commit,
- url: function() {
- return sd.API_URL + '/repos/' + this.owner + '/' + this.repo + '/commits';
- },
- initialize: function(models, options) {
- this.owner = options.owner;
- this.repo = options.repo;
- }
- });