Skip to content

Commit 56b2c33

Browse files
committed
Updated documentation and applied some code formatting and standardization between PureMVC frameworks.
1 parent 5ca8990 commit 56b2c33

File tree

8 files changed

+60
-48
lines changed

8 files changed

+60
-48
lines changed

bin/puremvc-typescript-multicore-1.0-min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/puremvc-typescript-multicore-1.0.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ if( typeof define === "function" )
129129
View.prototype.hasMediator = function (mediatorName) {
130130
return this.mediatorMap[mediatorName] != null;
131131
};
132+
View.MULTITON_MSG = "View instance for this multiton key already constructed!";
132133
View.instanceMap = {
133134
};
134-
View.MULTITON_MSG = "View instance for this multiton key already constructed!";
135135
View.getInstance = function getInstance(key) {
136136
if(!View.instanceMap[key]) {
137137
View.instanceMap[key] = new View(key);
@@ -189,9 +189,9 @@ if( typeof define === "function" )
189189
delete this.commandMap[notificationName];
190190
}
191191
};
192+
Controller.MULTITON_MSG = "Controller instance for this multiton key already constructed!";
192193
Controller.instanceMap = {
193194
};
194-
Controller.MULTITON_MSG = "Controller instance for this multiton key already constructed!";
195195
Controller.getInstance = function getInstance(key) {
196196
if(!Controller.instanceMap[key]) {
197197
Controller.instanceMap[key] = new Controller(key);
@@ -474,6 +474,7 @@ if( typeof define === "function" )
474474
for(var i = 0; i < len; i++) {
475475
var commandClassRef = subCommands[i];
476476
var commandInstance = new commandClassRef();
477+
commandInstance.initializeNotifier(this.multitonKey);
477478
commandInstance.execute(notification);
478479
}
479480
this.subCommands.splice(0);

src/org/puremvc/typescript/multicore/core/Controller.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module puremvc
9292
* <code>initializeController</code> method in the following way:
9393
*
9494
* <pre>
95-
* // ensure that the Controller is talking to my IView implementation
95+
* // Ensure that the Controller is talking to my <code>IView</code> implementation.
9696
* initializeController():void
9797
* {
9898
* this.view = MyView.getInstance( this.multitonKey );
@@ -137,8 +137,8 @@ module puremvc
137137
* <code>INotification</code>s with this name, it is no longer used, the new
138138
* <code>ICommand</code> is used instead.
139139
*
140-
* The <code>Observer</code> for the new <code>ICommand</code> is only created if this the
141-
* first time an <code>ICommand</code> has been registered for this
140+
* The <code>Observer</code> for the new <code>ICommand</code> is only created if this is
141+
* the first time an <code>ICommand</code> has been registered for this
142142
* <code>Notification</code> name.
143143
*
144144
* @param notificationName
@@ -154,7 +154,7 @@ module puremvc
154154

155155
this.commandMap[ notificationName ] = commandClassRef;
156156
}
157-
157+
158158
/**
159159
* Check if an <code>ICommand</code> is registered for a given <code>Notification</code>.
160160
*
@@ -189,12 +189,6 @@ module puremvc
189189
}
190190
}
191191

192-
/**
193-
* <code>Controller</code> singleton instance map.
194-
*
195-
* @protected
196-
*/
197-
static instanceMap:Object = {};
198192

199193
/**
200194
* Error message used to indicate that a <code>Controller</code> singleton instance is
@@ -204,7 +198,14 @@ module puremvc
204198
* @constant
205199
*/
206200
static MULTITON_MSG:string = "Controller instance for this multiton key already constructed!";
207-
201+
202+
/**
203+
* <code>Controller</code> singleton instance map.
204+
*
205+
* @protected
206+
*/
207+
static instanceMap:Object = {};
208+
208209
/**
209210
* <code>Controller</code> multiton factory method.
210211
*

src/org/puremvc/typescript/multicore/core/Model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module puremvc
55
{
66
"use strict";
7-
7+
88
/**
99
* The <code>Model</code> class for PureMVC.
1010
*
@@ -20,7 +20,7 @@ module puremvc
2020
*
2121
* Your application must register <code>IProxy</code> instances with the <code>Model</code>.
2222
* Typically, you use an <code>ICommand</code> to create and register <code>Proxy</code> instances
23-
* once the <code>Facade</code> has initialized the Core actors.
23+
* once the <code>Facade</code> has initialized the core actors.
2424
*/
2525
export class Model
2626
implements IModel
@@ -33,7 +33,7 @@ module puremvc
3333
proxyMap:Object = null;
3434

3535
/**
36-
* The multiton Key for this Core.
36+
* The multiton key for this core.
3737
*
3838
* @protected
3939
*/
@@ -65,7 +65,7 @@ module puremvc
6565
/**
6666
* Initialize the multiton <code>Model</code> instance.
6767
*
68-
* Called automatically by the constructor, this is the opportunity to initialize the
68+
* Called automatically by the constructor. This is the opportunity to initialize the
6969
* multiton instance in a subclass without overriding the constructor.
7070
*
7171
* @protected
@@ -127,7 +127,7 @@ module puremvc
127127
}
128128

129129
/**
130-
* Check if a Proxy is registered
130+
* Check if an <code>IProxy</code> is registered.
131131
*
132132
* @param proxyName
133133
* The name of the <code>IProxy</code> to verify the existence of its registration.

src/org/puremvc/typescript/multicore/core/View.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module puremvc
5858
* Multiton key for this instance of <code>View</code>.
5959
*
6060
* @throws Error
61-
* Throws an error if an instance for this multiton has already been constructed.
61+
* Throws an error if an instance for this multiton key has already been constructed.
6262
*/
6363
constructor( key:string )
6464
{
@@ -70,10 +70,10 @@ module puremvc
7070
this.multitonKey = key;
7171
this.mediatorMap = {};
7272
this.observerMap = {};
73-
73+
7474
this.initializeView();
7575
}
76-
76+
7777
/**
7878
* Initialize the multiton <code>View</code> instance.
7979
*
@@ -106,8 +106,8 @@ module puremvc
106106
}
107107

108108
/**
109-
* Remove a list of <code>Observer</code>s for a given <code>notifyContext</code> from an
110-
* <code>Observer</code> list for a given <code>INotification</code> name.
109+
* Remove a list of <code>IObserver</code>s for a given <code>notifyContext</code> from an
110+
* <code>IObserver</code> list for a given <code>INotification</code> name.
111111
*
112112
* @param notificationName
113113
* Which <code>IObserver</code> list to remove from.
@@ -271,19 +271,13 @@ module puremvc
271271
* The <code>IMediator</code> name to check whether it is registered.
272272
*
273273
* @return
274-
* A <code>Mediator</code> is registered with the given <code>mediatorName</code>.
274+
* An <code>IMediator</code> is registered with the given <code>mediatorName</code>.
275275
*/
276276
hasMediator( mediatorName:string ):bool
277277
{
278278
return this.mediatorMap[ mediatorName ] != null;
279279
}
280280

281-
/**
282-
* <code>View</code> singleton instance map.
283-
*
284-
* @protected
285-
*/
286-
static instanceMap:Object = {};
287281

288282
/**
289283
* Error message used to indicate that a <code>View</code> singleton instance is
@@ -294,6 +288,13 @@ module puremvc
294288
*/
295289
static MULTITON_MSG:string = "View instance for this multiton key already constructed!";
296290

291+
/**
292+
* <code>View</code> singleton instance map.
293+
*
294+
* @protected
295+
*/
296+
static instanceMap:Object = {};
297+
297298
/**
298299
* <code>View</code> multiton factory method.
299300
*

src/org/puremvc/typescript/multicore/patterns/facade/Facade.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ module puremvc
2525
* <LI>Providing all the methods defined by the <code>IModel</code>, <code>IView</code>, &
2626
* <code>IController</code> interfaces.
2727
* <LI>Providing the ability to override the specific <code>Model</code>, <code>View</code> and
28-
* <code>Controller</code> singletons created.
28+
* <code>Controller</code> multitons created.
2929
* <LI>Providing a single point of contact to the application for registering
30-
* <code>Commands</code> and notifying <code>Observer</code>s.
30+
* <code>ICommand</code>s and notifying <code>IObserver</code>s.
3131
*
32-
* This <code>Facade</code> implementation is a singleton and cannot be instantiated directly,
33-
* but instead calls the static singleton factory method <code>Facade.getInstance()</code>.
32+
* This <code>Facade</code> implementation is a multiton instance and cannot be instantiated directly,
33+
* but instead calls the static multiton factory method <code>Facade.getInstance( key )</code>.
3434
*/
3535
export class Facade
3636
implements IFacade
@@ -48,7 +48,7 @@ module puremvc
4848
* @protected
4949
*/
5050
view:IView = null;
51-
51+
5252
/**
5353
* Local reference to the <code>Controller</code> multiton.
5454
*
@@ -291,7 +291,7 @@ module puremvc
291291
* Register a <code>IMediator</code> with the <code>IView</code>.
292292
*
293293
* @param mediator
294-
A reference to the <code>IMediator</code>.
294+
* A reference to the <code>IMediator</code>.
295295
*/
296296
registerMediator( mediator:IMediator ):void
297297
{
@@ -348,7 +348,7 @@ module puremvc
348348
}
349349

350350
/**
351-
* Notify the <code>IObservers</code> for a particular <code>INotification</code>.
351+
* Notify the <code>IObserver</code>s for a particular <code>INotification</code>.
352352
*
353353
* This method is left public mostly for backward compatibility, and to allow you to
354354
* send custom notification classes using the <code>Facade</code>.

0 commit comments

Comments
 (0)