Last active
December 10, 2015 10:38
-
-
Save philmander/4422082 to your computer and use it in GitHub Desktop.
Inverted intro with IOC
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" | |
] | |
}, | |
jsonMovieFinder: { | |
module: "movies/json-movie-finder" | |
args: [ | |
"http://jsonp.movies.com/jsonp" | |
] | |
}, | |
mongoMovieFinder: { | |
args: [{ | |
host: "http://movies.com/mongo", | |
username: "movieapp", | |
password: "12345abc" | |
}]; | |
} | |
} | |
}; | |
}); |
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-app.js | |
require(["inverted", "app-config"], function(inverted, conf) { | |
//create an appcontext usiing the app config | |
var appContext = inverted.create(conf); | |
//get an instance of the MoveLister class | |
appContext.getProto("movieLister", function(movieLister) { | |
movieLister.showMovies(); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment