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/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
//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/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/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
//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/movie-lister.js | |
define(function() { | |
var MovieLister = function(movieFinder) { | |
this.movieFinder = movieFinder; | |
}; | |
MovieLister.prototype.showMovies = function(query) { | |
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(["movies/json-movie-finder"], function(MovieFinder) { | |
var MovieLister = function() { | |
//hard coded dependency | |
this.movieFinder = new MovieFinder(); | |
}; | |
MovieLister.prototype.showMovies = function(query) { |
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-lister.js | |
define(function() { | |
var MovieLister = function() { | |
//constructor stuff | |
}; | |
return MovieLister; | |
}); | |
//movies/move-viewer.js | |
define(function() { |
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
require(["inverted", "app-config"], function(inverted, conf) { | |
var appContext = inverted.create(conf); | |
appContext.getProto("movieLister", function(movieLister) { | |
movieLister.showMovies(); | |
}; | |
}); |