Created
December 21, 2016 12:06
-
-
Save rahulsahay19/54f76e4c1d8e484d38aa138b8be69279 to your computer and use it in GitHub Desktop.
handlers
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("movieApp",["jquery","movieManagement"],function($,movieManagement){ | |
/* event handlers */ | |
function _addMovie(){ | |
movieManagement.add(); | |
} | |
function _clearMovie(){ | |
movieManagement.clear(); | |
} | |
function _saveMovie(){ | |
movieManagement.save(); | |
} | |
function _deleteMovie(clickEvent){ | |
movieManagement.remove(clickEvent); | |
} | |
// Its good idea to prefix private methods with _ | |
function _registerEventHandlers() { | |
$("#new-movie-button").on("click", _addMovie); | |
$("#delete-all-button").on("click", _clearMovie); | |
$("#save-button").on("click", _saveMovie); | |
$("#movie-list").on("click", ".delete-button", _deleteMovie); | |
} | |
return{ | |
init:function(){ | |
_registerEventHandlers(); | |
movieManagement.render(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment