Opened 8 years ago
Closed 4 years ago
#15366 closed enhancement (patchwelcome)
Allow for a more generic definition of aspects
Reported by: | Philippe Soares | Owned by: | Kitson Kelly |
---|---|---|---|
Priority: | low | Milestone: | 1.13 |
Component: | Events | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Hi, In the current dojox/lang/aspect package it's possible to define an aspect like this :
aop.advise(object, [/^set/, "update"], logCall);
However, in dojo/aspect, we can only pass a method name to be advised, like :
aspect.after(dojo, "xhr", function(deferred){...});
It would be nice if we could retrieve the dojox functionality in dojo/aspect.
If possible, the first parameter (the object containing the advised function) should also be configurable through an array of objects, object names, or regular expressions.
Indeed, how can I currently do things like : "Run foo() before any function whose name starts with "get" on any object ?
Something like this could be nice :
aspect.after([/.*/], ["xhr", /^get/], function(deferred){...});
or
aspect.after(["dijit/form"], ["startup", "postConstruct"], function(deferred){...});
Sorry if any of this is already possible. I didn't try, but the documentation makes me think that it is not...
Change History (3)
comment:1 Changed 8 years ago by
Component: | General → Core |
---|---|
Milestone: | tbd → future |
Owner: | set to Kitson Kelly |
Priority: | undecided → low |
Status: | new → assigned |
comment:2 Changed 8 years ago by
Component: | Core → Events |
---|
comment:3 Changed 4 years ago by
Milestone: | future → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | assigned → closed |
Given that no one has shown interest in creating a patch in the past 3+ years, I'm closing this as patchwelcome.
I've been putting aspect bugs under the "Events" category although one could argue definitions.
(Whether or not we want this new functionality in core is a separate question though.)