Skip to content

Instantly share code, notes, and snippets.

@Coaden
Last active March 9, 2016 14:05
Show Gist options
  • Save Coaden/6630e0fb455ca1f3e8ce to your computer and use it in GitHub Desktop.
Save Coaden/6630e0fb455ca1f3e8ce to your computer and use it in GitHub Desktop.
JavaScript Module Pattern Example with Prototype
if (!CalendarForm) {
// constructor
CalendarForm = function () {
var self = this;
var clientID = @hml....
$('#addAppointmentButton').on('click', function() {
self.addAppointment();
});
$('#viewAppointmentButton').on('click', function () {
self.viewAppointment();
});
};
CalendarForm.prototype = {
load: function() {
},
addAppointment: function () {
},
viewAppointment: function () {
}
};
}
// run asynchronously to let the page finish loading
setTimeout(function () {
var form = new CalendarForm();
form.load();
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment