/[Frey]/trunk/static/lib/Joose/Decorator.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/static/lib/Joose/Decorator.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 46 - (hide annotations)
Wed Jul 2 10:28:49 2008 UTC (15 years, 11 months ago) by dpavlin
File MIME type: application/javascript
File size: 947 byte(s)
added upstream Joose r4755

http://code2.0beta.co.uk/moose/svn/Joose/trunk/lib
1 dpavlin 46 Class("Joose.Decorator", {
2     meta: Joose.Role,
3     methods: {
4     decorate: function (classObject, attributeName, optionalDelegatorFuncMaker) {
5     var me = this;
6     Joose.A.each(classObject.meta.getInstanceMethods(), function (m) {
7     var name = m.getName();
8     var argName = attributeName;
9     // only override non existing methods
10     if(!me.can(name)) {
11    
12     var func = function () {
13     var d = this[argName];
14     return d[name].apply(d, arguments)
15     }
16    
17     if(optionalDelegatorFuncMaker) {
18     func = optionalDelegatorFuncMaker(name)
19     }
20    
21     me.addMethod(name, func);
22     }
23     })
24     }
25     }
26     })
27    
28     Joose.Decorator.meta.apply(Joose.Class)

  ViewVC Help
Powered by ViewVC 1.1.26