Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Andy Dennis’ function introduction
<html>
<body>
<a class="that" href="yippee.html">That link</a>
<script>
var foo = function () {
var $ = document.querySelector.bind(document)
var el = {
thatLink: $('a.that')
}
function addListeners () {
el.thatLink.addEventListener('click', function (e) {
e.preventDefault()
simpleHandler((link: http://e.target) e.target)
}, false)
}
function init () {
addListeners()
}
function simpleHandler (link) {
console.log(link.href)
}
return {
init: init
}
}()
foo.init()
</script>
<body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment