Skip to content

Commit 91fc8fe

Browse files
author
Cliff Hall
committed
setMultitonKey becomes initializeNotifier
1 parent a2ffd1c commit 91fc8fe

File tree

6 files changed

+33
-8
lines changed

6 files changed

+33
-8
lines changed

src/org/puremvc/as3/multicore/core/Controller.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ package org.puremvc.as3.multicore.core
113113
if ( commandClassRef == null ) return;
114114

115115
var commandInstance : ICommand = new commandClassRef();
116-
commandInstance.setMultitonKey( multitonKey );
116+
commandInstance.initializeNotifier( multitonKey );
117117
commandInstance.execute( note );
118118
}
119119

src/org/puremvc/as3/multicore/core/Model.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ package org.puremvc.as3.multicore.core
8989
*/
9090
public function registerProxy( proxy:IProxy ) : void
9191
{
92-
proxy.setMultitonKey( multitonKey );
92+
proxy.initializeNotifier( multitonKey );
9393
proxyMap[ proxy.getProxyName() ] = proxy;
9494
}
9595

src/org/puremvc/as3/multicore/core/View.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ package org.puremvc.as3.multicore.core
136136
public function registerMediator( mediator:IMediator ) : void
137137
{
138138

139-
mediator.setMultitonKey( multitonKey );
139+
mediator.initializeNotifier( multitonKey );
140140

141141
// Register the Mediator for retrieval by name
142142
mediatorMap[ mediator.getMediatorName() ] = mediator;

src/org/puremvc/as3/multicore/interfaces/INotifier.as

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,15 @@ package org.puremvc.as3.multicore.interfaces
4343
function sendNotification( notificationName:String, body:Object=null, type:String=null ):void;
4444

4545
/**
46-
* Set the multitonKey for this INotifier instance
46+
* Initialize this INotifier instance.
47+
* <P>
48+
* This is how a Notifier gets its multitonKey.
49+
* Calls to sendNotification or to access the
50+
* facade will fail until after this method
51+
* has been called.</P>
52+
*
53+
* @param key the multitonKey for this INotifier to use
4754
*/
48-
function setMultitonKey( key:String ): void;
55+
function initializeNotifier( key:String ): void;
4956
}
5057
}

src/org/puremvc/as3/multicore/patterns/facade/Facade.as

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ package org.puremvc.as3.multicore.patterns.facade
3232
*/
3333
public function Facade( key:String ) {
3434
if (instanceMap[ key ] != null) throw Error(MULTITON_MSG);
35-
setMultitonKey( key );
35+
initializeNotifier( key );
3636
instanceMap[ multitonKey ] = this;
3737
initializeFacade();
3838
}
@@ -302,7 +302,7 @@ package org.puremvc.as3.multicore.patterns.facade
302302
* It is necessary to be public in order to
303303
* implement INotifier.</P>
304304
*/
305-
public function setMultitonKey( key:String ):void
305+
public function initializeNotifier( key:String ):void
306306
{
307307
multitonKey = key;
308308
}

src/org/puremvc/as3/multicore/patterns/observer/Notifier.as

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,25 @@ package org.puremvc.as3.multicore.patterns.observer
6060
facade.sendNotification( notificationName, body, type );
6161
}
6262

63-
public function setMultitonKey( key:String ):void
63+
/**
64+
* Initialize this INotifier instance.
65+
* <P>
66+
* This is how a Notifier gets its multitonKey.
67+
* Calls to sendNotification or to access the
68+
* facade will fail until after this method
69+
* has been called.</P>
70+
*
71+
* <P>
72+
* Mediators, Commands or Proxies may override
73+
* this method in order to send notifications
74+
* or access the Multiton Facade instance as
75+
* soon as possible. They CANNOT access the facade
76+
* in their constructors, since this method will not
77+
* yet have been called.</P>
78+
*
79+
* @param key the multitonKey for this INotifier to use
80+
*/
81+
public function initializeNotifier( key:String ):void
6482
{
6583
multitonKey = key;
6684
}

0 commit comments

Comments
 (0)