Last active
March 9, 2016 14:05
-
-
Save Coaden/6630e0fb455ca1f3e8ce to your computer and use it in GitHub Desktop.
JavaScript Module Pattern Example with Prototype
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
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