Long story short, documentation has to match, even if its across multiple sites. Current official pureMVC JavaScript port is messy and definitely does not match the documentation at MooTools.
Simply put:
Here’s how mootools show their Class usage example:
[cc lang="javascript"]var Animal = new Class({ initialize: function(options){ this.options = options; this.isAlive = true; } }); var Mammal = new Class({ Extends: Animal, initialize: function(options){ this.parent(options); this.isWarmBlooded = true; this.hasFur = true; this.producesMilk = true; }, sleep: function() { this.isAsleep = true; }, awake: function(){ this.isAsleep = false; } }); [/cc]
Implementation at pureMVC_JS
[cc lang="javascript"]var SimpleCommand = function(){ this.Extends = Notifier; /** * @ignore */ this.initialize = function() { this.parent(); } /** * Fulfill the use-case initiated by the givenNotification
. * ** In the Command Pattern, an application use-case typically * begins with some user action, which results in a
* * @param {Notification} notification theNotification
being broadcast, which * is handled by business logic in theexecute
method of an *ICommand
.Notification
to handle. */ this.execute = function(notification /* Notification */){} } SimpleCommand = new Class(new SimpleCommand());[/cc]
My implementation pureMVC-oop.js
[cc lang="javascript"]SimpleCommand = new Class({ Extends : Notifier, /** * @ignore */ initialize : function(){ this.parent(); }, /** * Fulfill the use-case initiated by the givenNotification
. * ** In the Command Pattern, an application use-case typically * begins with some user action, which results in a
* * @param {Notification} notification theNotification
being broadcast, which * is handled by business logic in theexecute
method of an *ICommand
.Notification
to handle. */ execute : function(notification /* Notification */){ } });[/cc]
I have adapted the syntax suggested in MooTools for this port. Why this was not done in the beginning I have no clue. Sure, I had to use a hack here and there when using pureMVC, specially with “static” values, but still its cleaner than the current official version
3 Comments