Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #24820

Re: Bind custom function to the all Function objects

Newsgroups comp.lang.javascript
Date 2014-06-13 08:39 -0700
References <98e91$539b0b89$6def49ce$21580@nntpswitch.blueworldhosting.com> <1649322.pjBWu2vbqe@PointedEars.de> <94a15$539b16e4$6def49ce$21821@nntpswitch.blueworldhosting.com>
Message-ID <576fdad7-76a6-479f-b4de-90d3cc8e56dd@googlegroups.com> (permalink)
Subject Re: Bind custom function to the all Function objects
From "Michael Haufe (TNO)" <tno@thenewobjective.com>

Show all headers | View raw


"On Friday, June 13, 2014 9:32:37 AM UTC-5, Cezary Tomczyk wrote:
> I am looking for a solution where I can bind custom function to the all 
> Function objects. Whenever any function/method will be called I'd like 
> to call my custom function. I am going to use it only for 
> testing/debugging. Doesn't have to be cross-browser.
> 
> Can someone suggest from where to start?

Potentially with Proxies, but you'll have to do a bit of manual work:

---

function foo(){
    alert("Foo")
}

var bar = Proxy(foo,{
    apply: function(target,thisArg,args){
        alert("Proxy was called");
        target.apply(thisArg,args);
    }
})

bar()

---

more: <http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies>"

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bind custom function to the all Function objects Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-06-13 16:32 +0200
  Re: Bind custom function to the all Function objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-13 16:56 +0200
    Re: Bind custom function to the all Function objects Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-06-13 17:21 +0200
      Re: Bind custom function to the all Function objects "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-06-13 08:39 -0700
      Re: Bind custom function to the all Function objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-13 19:01 +0200
        Re: Bind custom function to the all Function objects Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-06-13 22:41 +0200
          Re: Bind custom function to the all Function objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-14 01:57 +0200
            Re: Bind custom function to the all Function objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-14 15:55 +0200
            Re: Bind custom function to the all Function objects Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-06-16 21:55 +0200
              Re: Bind custom function to the all Function objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-16 23:26 +0200
  Re: Bind custom function to the all Function objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-18 21:04 +0200

csiph-web