Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Maybe AOP libraries for javascript like meld will help you?

For example:

var timeTook;
var myObject = {
 doSomething: function(a, b) { 
 return a + b;
 }
};
function beforeFunction() {
 timeTook = performance.now();
}
function afterFunction() {
 console.log("It took " + (performance.now() - timeTook));
}
meld.before(myObject, 'doSomething', beforeFunction);
meld.after(myObject, 'doSomething', afterFunction);

See Also this question this question in SO.

Maybe AOP libraries for javascript like meld will help you?

For example:

var timeTook;
var myObject = {
 doSomething: function(a, b) { 
 return a + b;
 }
};
function beforeFunction() {
 timeTook = performance.now();
}
function afterFunction() {
 console.log("It took " + (performance.now() - timeTook));
}
meld.before(myObject, 'doSomething', beforeFunction);
meld.after(myObject, 'doSomething', afterFunction);

See Also this question in SO.

Maybe AOP libraries for javascript like meld will help you?

For example:

var timeTook;
var myObject = {
 doSomething: function(a, b) { 
 return a + b;
 }
};
function beforeFunction() {
 timeTook = performance.now();
}
function afterFunction() {
 console.log("It took " + (performance.now() - timeTook));
}
meld.before(myObject, 'doSomething', beforeFunction);
meld.after(myObject, 'doSomething', afterFunction);

See Also this question in SO.

Bounty Awarded with 25 reputation awarded by Community Bot
Source Link
Elad
  • 1.2k
  • 10
  • 16

Maybe AOP libraries for javascript like meld will help you?

For example:

var timeTook;
var myObject = {
 doSomething: function(a, b) { 
 return a + b;
 }
};
function beforeFunction() {
 timeTook = performance.now();
}
function afterFunction() {
 console.log("It took " + (performance.now() - timeTook));
}
meld.before(myObject, 'doSomething', beforeFunction);
meld.after(myObject, 'doSomething', afterFunction);

See Also this question in SO.

lang-js

AltStyle によって変換されたページ (->オリジナル) /