Decorate a method with Dojo
Posted by Mike on Oct 2nd, 2008
Here’s a quick example of how to incorporate the Decorator Pattern into your javascript code using the Dojo framework. Rather than decorating an entire class, this example merely decorates a single function, extending the original function with some extra logic.
// Instantiate widget class
var w = new core.widget.MyWidget();
// Decorate the original "method1" function
var _old_method1 = [...]
- Filed under coding
- Tagged with aop, aspect, dojo, javascript, patterns
- Comments(0)
