Last active
August 29, 2015 14:04
-
-
Save apt142/c80398d70cbe5108b164 to your computer and use it in GitHub Desktop.
Sandboxed JS Module
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
/* Js for /NAMESPACE/MODULE */ | |
NAMESPACE = NAMESPACE || {}; | |
NAMESPACE.MODULE = (function() { | |
var obj = { | |
// Context to operate in | |
context: '#side-well', | |
init: function ($el) { | |
this.$el = $el; | |
// Initialize stuff here | |
this.$('.btn').click(function () { | |
// Do something | |
window.console.log('click'); | |
}); | |
}, | |
$: function (selector) { | |
return this.$el.find(selector); | |
}, | |
additionalFunctions: function (data) {} | |
}; | |
$(document).ready(function () { | |
var $el = $(obj.context); | |
if ($el.length) { | |
obj.init($el); | |
} | |
}); | |
return obj; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment