Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6998823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:27:40+00:00 2026-05-27T20:27:40+00:00

How can i overload the calling process of any function? In my web app

  • 0

How can i overload the calling process of any function?

In my web app i want to do something before the call of a function and something after it how can i do this without prototyping the call method ( because i tried this and it will work only if i call a function as myFunction.call() ) and still have the requested effect.

I have tried everything for making it work, but nothing works, and to do it the hard way ( by call method ) it’s non-practicable because i would have to rewrite all my code.

Could someone help please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:27:40+00:00Added an answer on May 27, 2026 at 8:27 pm

    You can change each function definition manually.
    You can change each function call manually.
    If either of these refactorings is out of the scope of your problems then you’re in a spot of bother.

    There is no generic way that I’m familiar with to solve your problem.

    However if your functions are globally accessible or namespaced then you can do the following quite easily (and can make it much more generic by parametrising the pre and post functions etc.):

    NS = {
       foo : function(){ console.log('foo'); },
       bar : function(){ console.log('bar'); }
    };
    
    // <-- new code goes here
    
    NS.foo();
    NS.bar();
    
    // new code below, that should go after definitions but before the calls
    
    (function(){
    
       var pre = function(){ console.log('pre'); },
           post = function(){ console.log('post'); };
    
       for (var fn in NS) {
          NS[fn] = (function(fn){ return function(){ pre(); fn(); post(); }; })(fn);
       }
    
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently discovered that in C++ you can overload the function call operator, in
We all know that you can overload a function according to the parameters: int
I'm wondering if you can overload an operator and use it without changing the
How one can overload an operator<< for a nested private class like this one?
This has happenned before and I can't remember how I solved it. I renamed
Possible Duplicate: Any reason to overload global new and delete? In c++ you can
Since C+++ allows function overloading, can we overload main() ? For example, int main(const
Is there a possibility to overload __cinit__ or __add__ ? Something like this: cdef
How can I overload a method that takes a Generic List with different types
I know that we can't overload operator with other meaning, we can't create new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.