changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

Callbacks support #316

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The clients of the API provided by wro4j, should be able to add different 
callbacks, like:

- onBeforeMerge(Resource)
- onAfterMerge(Resource)
- onBeforeProcess(Resource)
- onAfterProcess(Resource)

The above methods are just an example. Their name and addition of other 
callbacks methods can be changed (based on user suggestions) or requirements.

Original issue reported on code.google.com by alex.obj...@gmail.com on 15 Oct 2011 at 9:59

GoogleCodeExporter commented 9 years ago
I need a callbacks before and after the actual processing of the resources. 
These callbacks may accept the constructed WroManager as context parameter.

Original comment by martin.g...@gmail.com on 8 Dec 2011 at 11:34

GoogleCodeExporter commented 9 years ago
Can you add the exact callbacks signature to the comment? Thanks.

Original comment by alex.obj...@gmail.com on 8 Dec 2011 at 11:43

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 8 Dec 2011 at 11:52

GoogleCodeExporter commented 9 years ago
Fixed initial version which expose only empty methods (no arguments). 

Original comment by alex.obj...@gmail.com on 12 Dec 2011 at 4:28

GoogleCodeExporter commented 9 years ago
Hi Alex,

I just reviewed 
https://github.com/alexo/wro4j/commit/ad1a922e99845f0079261c7cd4503a806f4d3b00 
(merge "callback" branch into 1.4.x).
I'd like to ask for two more methods:
- onBeforeProcess() - called before the first preprocessor
- onAfterProcess() - called after the last postprocessor

You may have better names for those...
Thanks for the improvements!

Original comment by martin.g...@gmail.com on 13 Dec 2011 at 8:21

GoogleCodeExporter commented 9 years ago
Hi Martin,
Good point. Thanks for suggestion!

Original comment by alex.obj...@gmail.com on 13 Dec 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Fixed in 1.4.x branch. Renamed it like this:

  /**
   * Called before resources are merged and before any processing is applied.
   */
  void onBeforeMerge();

  /**
   * Called after all resources are merged and the preProcessing is completed.
   */
  void onAfterMerge();
  /**
   * Called after all postProcessors are applied and overall processing is complete.
   */
  void onProcessingComplete();

@marting please review the code and let me know if you have any other 
suggestions.

Original comment by alex.obj...@gmail.com on 13 Dec 2011 at 2:44

GoogleCodeExporter commented 9 years ago
Hi Alex,

Looks perfect!
Thanks!

Original comment by martin.g...@gmail.com on 14 Dec 2011 at 7:43