Opened 7 years ago

Closed 3 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 7 years ago by Kitson Kelly

Component: GeneralCore
Milestone: tbdfuture
Owner: set to Kitson Kelly
Priority: undecidedlow
Status: newassigned

comment:2 Changed 7 years ago by bill

Component: CoreEvents

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.)

comment:3 Changed 3 years ago by dylan

Milestone: future1.12
Resolution: patchwelcome
Status: assignedclosed

Given that no one has shown interest in creating a patch in the past 3+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.