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 Dog = [ | |
"bark", "eat", "defecate" | |
]; | |
var Poodle = function(name) { //implements Dog | |
this.name = name; | |
}; | |
Poodle.prototype = { | |
bark: function() {}, | |
eat: function() {}, | |
defecate: 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
//a car factory | |
var CarFactory = { | |
getTires: function() { | |
if(weather.raining) { | |
return new WetTireSet(); | |
} | |
else { | |
return new SlickTireSet(); | |
} | |
} |
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
<?xml version="1.0"?> | |
<project default="cssDataUriEmbed" basedir="." xmlns:ca="antlib:net.sourceforge.clearantlib"> | |
<property name="build.dir" location="${basedir}/build" /> | |
<property name="websrc.dir" location="${basedir}/WebContent" /> | |
<taskdef name="cssurlembed" classname="net.nczonline.web.cssembed.CSSEmbedAntTask" > | |
<classpath> | |
<fileset dir="${basedir}/lib" includes="cssembed-0.3.3.jar"/> | |
</classpath> | |
</taskdef> | |
<target name="setup"> |
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
<!--[if !IE]>--> | |
<link type="text/css" rel="stylesheet" href="/css/site-datauri.css"> | |
<!--<![endif]--> | |
<!--[if gte IE 9]> | |
<link type="text/css" rel="stylesheet" href="/css/site-datauri.css"> | |
<![endif]--> | |
<!--[if lte IE 8]> | |
<link type="text/css" rel="stylesheet" href="/css/site-mhtml.css"> | |
<![endif]--> |
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
<script> | |
(function() { | |
function addStylesheet(dataUriHref, fallbackHref) { | |
var img = new Image(); | |
img.onload = img.onerror = function() { | |
var link = window.document.createElement("link"); | |
link.type = "text/css"; | |
link.rel = "stylesheet"; | |
link.href = this.width !== 1 ? fallbackHref : dataUriHref; |
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
define(function() { | |
return { | |
protos: { | |
movieLister: { | |
module: "movies/movie-lister", | |
args: [ | |
"*jsonMovieFinder" | |
] | |
}, | |
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
require(["inverted", "app-config"], function(inverted, conf) { | |
var appContext = inverted.create(conf); | |
appContext.getProto("movieLister", function(movieLister) { | |
movieLister.showMovies(); | |
}; | |
}); |
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
// 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/movie-lister.js | |
define(function() { | |
var MovieLister = function(movieFinder) { | |
this.movieFinder = movieFinder; | |
}; | |
MovieLister.prototype.showMovies = function(query) { | |
OlderNewer