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
//microdata polyfill (see https://github.com/termi/Microdata-JS) | |
casper.options.clientScripts.push("../../../support/a.js"); | |
casper.options.clientScripts.push("../../../support/microdata-js.js"); | |
/** | |
* Fetches microdata from the remote DOM environment, in a json object structure. | |
* @param itemType The item type of item scopes to fetch data for | |
* @returns {Object|mixed} | |
*/ | |
casper.fetchMicrodata = function(itemType) { |
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
// Mixed.js | |
define(function() { | |
var Mixed = function(a, b) { | |
this.a = a; | |
this.b = b; | |
}; | |
Mixed.prototype.getA = function() { | |
return this.a; | |
}; | |
Mixed.prototype.getB = 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
//app-config.js | |
define(function() { | |
return { | |
protos: { | |
movieLister: { | |
module: "movies/movie-lister", | |
args: [ | |
"*movieFinder" | |
] | |
mixin: { |
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: [ | |
//injects a json movie finder which must implement the movieFinder interface | |
"*jsonMovieFinder [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(["jquery"], function($) { | |
var MovieFinder = function() { | |
var self = this; | |
$(document).on("click", ".open-prefs", function() { | |
self.openPreferences(); | |
}); | |
}; | |
MovieFinder.prototype.openPreferences = 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
// movies/movie-lister.js | |
var MovieLister = function(movieFinder) { | |
this.movieFinder = movieFinder; | |
}; | |
MovieLister.prototype.showMovies = function(query) { | |
var keywords = query.split(" "); | |
var movieResult = this.movieFinder.getMovies(keywords); |
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" | |
}, |
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
//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
//movies/json-movie-finder.js | |
define(function() { | |
var JsonMovieFinder = function(jsonpUrl) { | |
this.jsonpUrl = jsonpUrl; | |
}; | |
return JsonMovieFinder; | |
}); | |
//movies/base-movie-finder.js |