archetype-resources.src.main.js.IndexContext.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javascript-ria-archetype
Show all versions of javascript-ria-archetype
A JavaScript Rich Internet Application template using jQuery and jQuery UI.
The newest version!
/*global define */
define([ "jquery", "HelloWorld/HelloWorldController", "HelloWorld/desktop/HelloWorldView", "model/HelloWorldCommand" ],
function($, HelloWorldController, HelloWorldView, HelloWorldCommand) {
/**
* Context for our index.html entry point.
*
* Sets up required objects, handles dependency injection, and starts
* the HelloWorldController.
*
* @class Context for our index.html entry point.
* @name IndexContext
*/
function IndexContext(){}
/**
* Initialize this context.
*
* Instantiates HelloWorld components, injects dependencies, and starts
* the HelloWorldController.
*/
IndexContext.prototype.initialize = function() {
var controller, view, command;
// Instantiate objects
controller = new HelloWorldController();
view = new HelloWorldView();
command = new HelloWorldCommand();
// Perform dependency injection by extending objects
$.extend(view, {
div: $("#helloWorld")
});
$.extend(controller, {
view: view,
command: command
});
// Start the HelloWorldController
controller.start();
};
// Return the function
return IndexContext;
});