Get Caller Function Name
a function to get the calling functions' name. Is as safe as possible and attempts to read the whole function if needed to get it.
HTML
<script src="https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js"></script>
<input type=button id="theButton" value="run test" class="runButton">
<div id="log" class="log"></div>
CSS
.runButton {
width: 125px;
margin: 20px;
}
.log {
padding:10px;
margin: 20px;
border: 1px dotted #ccc;
color:#888;
font-face: arial;
font-size:12px;
background: #fbfbfb;
}
JavaScript
var hashRoutes =
{
// =====================================
// -- HASH ROUTE -----------------------
// =====================================
'#ddd':function(hashData){
console.log(arguments.callee.name);
}
}
$("#theButton").on('click', function() {
console.log('clicky');
hashRoutes['#ddd']({});
});