So I set out to adapt PureMVC. I tweaked the Controller::executeCommand function the most, with some meddling with Controller:registerCommand, Facade::registerCommand, and their respective interfaces. Overall, only 4 files changed, with only the controller suffering essential functionality alteration. The only change in the API is that when you use registerCommand in your implementation of the Facade, you now have a third parameter, called 'singleton', of type Boolean, which defaults to false. If it is set to true, only one instance of that particular command will be created and then reused all throughout the life of the application.
Example of singleton command initialization:
this.registerCommand(STARTUP, StartupCommand, true);
You can download the changed PureMVC framework here.
No comments:
Post a Comment