Skip to content

Instantly share code, notes, and snippets.

@rahulsahay19
Created December 21, 2016 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulsahay19/455ce08d58fd4af7baa43f8d94ba0437 to your computer and use it in GitHub Desktop.
Save rahulsahay19/455ce08d58fd4af7baa43f8d94ba0437 to your computer and use it in GitHub Desktop.
moviesApp
define("movieApp",["jquery","movieManagement"],function($,movieManagement){
/* event handlers */
// Its good idea to prefix private methods with _
function _registerEventHandlers() {
$("#new-movie-button").on("click", movieManagement.add);
$("#delete-all-button").on("click", movieManagement.clear);
$("#save-button").on("click", movieManagement.save);
$("#movie-list").on("click", ".delete-button", movieManagement.remove);
}
return{
init:function(){
_registerEventHandlers();
movieManagement.render();
}
}
});
//To specfify what modules we are dependent on, we need to include require
require(["movieApp"],function(movieApp){
/* initialize app */
movieApp.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment