David Walsh has a great little intro to dojo/aspect that is worth reading.
So how could you use this to your advantage in your ArcGIS JS API apps?
Well, if you combine it with say dojo/has, you can add some fine-grained real time debugging tools into your application.
Let’s assume you have an application that selects features from a FeatureLayer. You could do your debugging right in your application code or you can provide a runtime flag that will do it for you.
Now you can set up some logic in your application to use dojo/aspect to monitor when that method is called and use it to provide logging in your application.
In this case we are using aspect.after to log the arguments sent to featureLayer.selectFeatures after it has been called. You could do it before as well, if you wanted to manipulate the arguments sent to the method. Maybe you want to limit the number of ObjectIds requested. This could make a good April Fools joke on someone.
Here is a demo of this app.
You could even stick your nose in where maybe it doesn’t belong and listen for when listeners are added to the document. I’ll add that to the above sample just for fun.
As you can see, the dojo/aspect module could come in handy in plenty of ways.
Don’t be afraid to get your hands dirty with it!