Skip to content

Instantly share code, notes, and snippets.

@lrsbt
Created May 19, 2025 12:38
Show Gist options
  • Save lrsbt/a7f72476d2f88080abc12df8edc15bd2 to your computer and use it in GitHub Desktop.
Save lrsbt/a7f72476d2f88080abc12df8edc15bd2 to your computer and use it in GitHub Desktop.
Object Literal Module Pattern in Javascript
const TEMPLATE = {
init() {
this.cacheDom();
this.bindEvents();
this.render();
},
cacheDom() {
// cache selectors
},
bindEvents() {
// bind jQuery events
},
render() {
console.log('Rendering');
}
};
jQuery(() => TEMPLATE.init());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment