get all calls to a function in javascript

Is there a way to find all the functions that call another function? (And then by extension, all the functions that call those functions, etc.)

My guess is it won't be possible for all cases, but certainly it could be done for most use cases, no? Like if somebody defines their function as:

new Function('a','b', 'return a'+'+b;');

it might be more tricky to find inner references.

Thanks in advance.

-------------Problems Reply------------

There is a arguments.caller but it's deprecated. Function.caller is replacement but you need function name - I'd use arguments.callee or directly the name.

In addition to its excellent outline view, Eclipse lets you "focus" the calls of a function in the source by selecting its declaration and then pressing F2. Appearances will be displayed in the right bar.

Category:javascript Views:0 Time:2011-10-02

Related post

  • How to convert an "object" into a function in JavaScript? 2008-09-23

    JavaScript allows functions to be treated as objects--if you first define a variable as a function, you can subsequently add properties to that function. How do you do the reverse, and add a function to an "object"? This works: var foo = function() {

  • Is there any kind of hash code function in JavaScript? 2008-10-11

    Basically, I'm trying to create an object of unique objects, a set. I had the brilliant idea of just using a JavaScript object with objects for the property names. Such as, set[obj] = true; This works, up to a point. It works great with string and nu

  • How can I pass arguments to anonymous functions in JavaScript? 2008-10-22

    I'm trying to figure out how to pass arguments to an anonymous function in JavaScript. Check out this sample code and I think you will see what I mean: <input type="button" value="Click me" id="myButton" /> <script type="text/javascript">

  • What is the scope of a function in Javascript/ECMAScript? 2008-10-24

    Today I had a discussion with a colleague about nested functions in Javascript: function a() { function b() { alert('boo') } var c = 'Bound to local call object.' d = 'Bound to global object.' } In this example, trials point out that b is not reachab

  • Can I copy/clone a function in JavaScript? 2009-01-15

    I'm using jQuery with the validators plugin. I would like to replace the "required" validator with one of my own. This is easy: jQuery.validator.addMethod("required", function(value, element, param) { return myRequired(value, element, param); }, jQue

  • Calling a jQuery function with JavaScript 2009-01-25

    I am using jQuery and JavaScript, I need to call the jQuery function inside my JavaScript code. My jQuery code: function display(id){ $.ajax({ type:'POST', url: 'ajax.php', data:'id='+id , success: function(data){ $("#response").html(data); }//succes

  • Left() function in Javascript or jQuery 2009-01-29

    I just want a very handy way to extract the numbers out of a string in Javascript and I am thinking about using jQuery, but I prefer the method that proves to be the simplest. I have requested the "left" attribute of a css block using jQuery like thi

  • List of global user defined functions in JavaScript? 2009-01-29

    Is it possible to get a list of the user defined functions in JavaScript? I'm currently using this, but it returns functions which aren't user defined: var functionNames = []; for (var f in window) { if (window.hasOwnProperty(f) && typeof win

  • What is the purpose of a self executing function in javascript? 2009-02-26

    In javascript, when would you want to use this: (function(){ //Bunch of code... })(); over this: //Bunch of code... --------------Solutions------------- Its all about variable scoping. Variables declared in the self executing function are, by default

  • Is there a sleep function in JavaScript? 2009-07-17

    This question already has an answer here: What do I do if I want a JavaScript version of sleep()? 42 answers Is there a sleep function in JavaScript? --------------Solutions------------- You can use the setTimeout or setInterval functions. If you are

  • How to pass an event object to a function in Javascript? 2009-08-14

    <button type="button" value="click me" onclick="check_me();" /> function check_me() { //event.preventDefault(); var hello = document.myForm.username.value; var err = ''; if(hello == '' || hello == null) { err = 'User name required'; } if(err !=

  • calling Jquery function from javascript 2009-08-28

    How can i call a jQuery function from javascript? //jquery $(function() { function my_fun(){ /.. some operations ../ } }); //just js function js_fun () { my_fun(); //== call jquery function } --------------Solutions------------- You can't. function()

  • destroy a function in javascript (jquery) 2009-10-30

    Is there anyone who knows how to destroy a javascript (jquery) function? I'm using jquery "selectable" and a function call "edit" is fired on selectable "stop" event. Inside this "edit" function I have nested switch functions with a lot of "click" ev

  • how to call actionscript function from javascript 2009-11-04

    I have a function like this in actionscript3 private function uploadFile(event:MouseEvent):void { var uploader:URLRequest = new URLRequest(serverUploadFile); localFile.upload(uploader); } how can i call this function from javascript ? thx -----------

  • simulate the tab key function in javascript 2009-11-26

    I am having a form with lots of entries. I would like to change my focus to the next textbox, once i entered the value in the current textbox. and want to continue this process upto the last field. My question is, is it possible to simulate tab key t

  • Why should I use a semicolon after every function in javascript? 2009-12-02

    I've seen different developers include semicolons after functions in javascript and some haven't. Which is best practice? function weLikeSemiColons(arg) { // bunch of code }; or function unnecessary(arg) { // bunch of code } --------------Solutions--

  • How are prototype functions different than normal functions in javascript ? 2009-12-09

    Javascript functions can be declared on a objects prototype like this: <object name>.prototype.<variable name>=function(){ // // } How it this different than following declaration? <object name>.<variable name>=function(){ //

  • What is the problems of using onClick function in Javascript? 2009-12-19

    Is there a particular reason programmers prefer not to use onClick function in Javascript? --------------Solutions------------- Your question is unclear. What criticism are you referring to? The only thing that springs to mind is the move towards uno

  • How do I call a php function from javascript onclick() event? 2010-01-10

    For example, I have a php function: function DeleteItem($item_id) { db_query("DELETE FROM {items} WHERE id=$item_id"); } Then, I have something like the following: <html> <head> <script type="text/javascript"> function DeleteItem($i

  • Using native code functions as JavaScript objects in WebKit 2010-01-18

    I'm unable to use native code functions as JavaScript objects in WebKit-based browsers. Is it impossible to alias these functions directly? This is easiest to explain by example, so here is what I am running in the Developer Tools console: console.wa

Copyright (C), All Rights Reserved.

processed in 0.071 (s). 11 q(s)