Skip to content

Instantly share code, notes, and snippets.

@nnnnathann
Last active December 29, 2015 14:09
Show Gist options
  • Save nnnnathann/7682415 to your computer and use it in GitHub Desktop.
Save nnnnathann/7682415 to your computer and use it in GitHub Desktop.
//main.js
require.config({
paths: {
jquery: 'components/jquery',
underscore: 'components/underscore',
backbone: 'components/backbone'
},
shim: {
jquery: { exports: '$' },
underscore: { exports: '_' },
backbone: { deps: ['jquery','underscore'], exports: 'Backbone' }
}
});
require(["app/test"], function(test) {
test.initialize();
});
//test.js
define(function(require){
var _ = require('underscore'),
Backbone = require('backbone'),
$ = require('jquery'),
Auth;
var initialize = function(){
Auth.Model = Backbone.Model.extend({
idAttribute: 'personId'
});
Auth.Collection = Backbone.Collection.extend({
model: Auth.Model,
url:"/api/auth/"
});
var bob = new Auth.Collection();
bob.fetch();
}
return {
initialize: initialize
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment