| 1 |
dojo.provide("dojox.lang.aspect.cflow"); |
| 2 |
|
| 3 |
|
| 4 |
(function(){ |
| 5 |
var aop = dojox.lang.aspect; |
| 6 |
|
| 7 |
aop.cflow = function( instance, method){ |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
if(arguments.length > 1 && !(method instanceof Array)){ |
| 22 |
method = [method]; |
| 23 |
} |
| 24 |
|
| 25 |
var contextStack = aop.getContextStack(); |
| 26 |
for(var i = contextStack.length - 1; i >= 0; --i){ |
| 27 |
var c = contextStack[i]; |
| 28 |
|
| 29 |
if(instance && c.instance != instance){ continue; } |
| 30 |
if(!method){ return true; } |
| 31 |
var n = c.joinPoint.targetName; |
| 32 |
for(var j = method.length - 1; j >= 0; --j){ |
| 33 |
var m = method[j]; |
| 34 |
if(m instanceof RegExp){ |
| 35 |
if(m.test(n)){ return true; } |
| 36 |
}else{ |
| 37 |
if(n == m){ return true; } |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
return false; |
| 42 |
}; |
| 43 |
})(); |