root / trunk / web / dojo / dojox / lang / oo / aop.js @ 13
History | View | Annotate | Download (1.03 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.lang.oo.aop"]){ |
||
9 | dojo._hasResource["dojox.lang.oo.aop"]=true; |
||
10 | dojo.provide("dojox.lang.oo.aop");
|
||
11 | dojo.require("dojox.lang.oo.Decorator");
|
||
12 | dojo.require("dojox.lang.oo.general");
|
||
13 | (function(){
|
||
14 | var oo=dojox.lang.oo,md=oo.makeDecorator,_1=oo.general,_2=oo.aop,_3=dojo.isFunction;
|
||
15 | _2.before=_1.before; |
||
16 | _2.around=_1.wrap; |
||
17 | _2.afterReturning=md(function(_4,_5,_6){
|
||
18 | return _3(_6)?function(){ |
||
19 | var _7=_6.apply(this,arguments); |
||
20 | _5.call(this,_7);
|
||
21 | return _7;
|
||
22 | }:function(){
|
||
23 | _5.call(this);
|
||
24 | }; |
||
25 | }); |
||
26 | _2.afterThrowing=md(function(_8,_9,_a){
|
||
27 | return _3(_a)?function(){ |
||
28 | var _b;
|
||
29 | try{
|
||
30 | _b=_a.apply(this,arguments); |
||
31 | } |
||
32 | catch(e){
|
||
33 | _9.call(this,e);
|
||
34 | throw e;
|
||
35 | } |
||
36 | return _b;
|
||
37 | }:_a; |
||
38 | }); |
||
39 | _2.after=md(function(_c,_d,_e){
|
||
40 | return _3(_e)?function(){ |
||
41 | var _f;
|
||
42 | try{
|
||
43 | _f=_e.apply(this,arguments); |
||
44 | } |
||
45 | finally{
|
||
46 | _d.call(this);
|
||
47 | } |
||
48 | return _f;
|
||
49 | }:function(){
|
||
50 | _d.call(this);
|
||
51 | }; |
||
52 | }); |
||
53 | })(); |
||
54 | } |