robotlegs / robotlegs-framework

An ActionScript 3 application framework for Flash and Flex
https://robotlegs.tenderapp.com/
MIT License
967 stars 261 forks source link

Add finally destroy feature #130

Closed hbakhtiyor closed 11 years ago

hbakhtiyor commented 11 years ago

Finally destroy listeners if child class forget calling destroy super class.

override public function destroy():void
{
  // do something
  // forget super.destroy() method
}

If you like it I will add unit tests and to other patterns.

What do you think?

creynders commented 11 years ago

Thanks for the PR. As a sidenote: in general we can't accept PR's w/o corresponding tests that (i) test the behaviour (ii) document the problem domain. Although I certainly understand what you aim to solve, I just wonder whether it's worth it. To make this work we'd need to add conditionals in DefaultMediatorManager to check whether the destroyed property and finallyDestroy method exist in the mediator under process. Also, I'm not a big fan of opening up methods through the use of namespaces, although granted, sometimes it just makes sense to use one. I don't think this will make it into the codebase, but need confirmation from @darscan

And I'm sorry if we deny the PR, it's great you're thinking of ways to improve RL!

darscan commented 11 years ago

I'm not sure if this exact patch is the right solution, but I do like the idea of making mediator teardown more reliable. Thanks for the suggestion, will think about this some more.

darscan commented 11 years ago

I've created a new issue for this.