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
//app-config.js | |
define(function() { | |
return { | |
protos: { | |
movieLister: { | |
module: "movies/movie-lister", | |
args: [ | |
"*jsonMovieFinder" | |
] | |
}, |
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
//movies/move-finder.js | |
define(function() { | |
var MovieFinder = function(jsonUrl, numMovies, includeShortFilms) { | |
this.jsonUrl = jsonUrl; | |
this.numMovies = numMovies; | |
this.includeShortFilms = includeShortFilms; | |
}; | |
return MovieFinder; | |
}); |
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
//movies/move-finder.js | |
define(function() { | |
var MovieFinder = function(options) { | |
this.jsonUrl = options.jsonUrl || null; | |
this.numMovies = options.numMovies || 10; | |
this.includeShortFilms = options.includeShortFilms || false; | |
}; | |
return MovieFinder; | |
}); |
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
//movies/movie-lister.js | |
define(function() { | |
var MovieLister = function(movieFinder) { | |
this.movieFinder = movieFinder; | |
}; | |
return MovieLister; | |
}); |
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
//movies/movie-lister.js | |
define(function() { | |
var MovieLister = function() { | |
this.movieFinder = null; | |
this.includeShortFilms = false; | |
this.numMovies = 10; | |
}; | |
MovieLister.prototype.setNumToShow = function(numToShow) { |
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
//movie/movie-util-instance.js | |
define(function() { | |
var MovieUtil = function() { | |
}; | |
MovieUtil.prototype.doSomething = function() { | |
//dostuff | |
}; |
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
//movies/json-movie-finder.js | |
define(function() { | |
var JsonMovieFinder = function(jsonpUrl) { | |
this.jsonpUrl = jsonpUrl; | |
}; | |
return JsonMovieFinder; | |
}); | |
//movies/base-movie-finder.js |
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
//movies/move-finder.js | |
define(function() { | |
var MovieFinder = function(username, accessCode) { | |
this.username = username; | |
this.accessCode = accessCode; | |
}; | |
return MovieFinder; | |
}); | |
//movies/movie-util.js |
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
var applicationConfig = { | |
// a map of 'protos', inverted objects | |
protos: { | |
//the unique id of a proto | |
protoId: { | |
//the amd or common js module name which exports the proto | |
module: "moduleName", | |
//contructor arguments to inject into protos with prototype or singleton scope | |
args: [ | |
//a literal value argument |
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
//example app config defining a jquery proto | |
define({function() { | |
return: { | |
protos: { | |
jquery: { | |
//assuming jquery's url is | |
//defined in the amd paths config | |
module: "jquery", | |
scope: "static" | |
}, |