Skip to content

Commit a51c3ae

Browse files
author
Cliff Hall
committed
use an implicit getter for the facade, so that it is lazily fetched when the property is read rather than at construction time. Throws an error if multitonKey is not yet set.
1 parent 7b27ce6 commit a51c3ae

File tree

1 file changed

+10
-3
lines changed
  • src/org/puremvc/as3/multicore/patterns/observer

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package org.puremvc.as3.multicore.patterns.observer
66
{
77
import org.puremvc.as3.multicore.interfaces.*;
8+
import org.puremvc.as3.multicore.patterns.facade.Facade;
89

910
/**
1011
* A Base <code>INotifier</code> implementation.
@@ -54,12 +55,18 @@ package org.puremvc.as3.multicore.patterns.observer
5455
multitonKey = key;
5556
}
5657

57-
58-
// Local reference to the Multiton Facade instance
59-
protected var facade:IFacade;
58+
// Return the Multiton Facade instance
59+
protected function get facade():IFacade
60+
{
61+
if ( multitonKey == null ) throw Error( MULTITON_MSG );
62+
return Facade.getInstance( multitonKey );
63+
}
6064

6165
// The Multiton Key for this app
6266
protected var multitonKey : String;
6367

68+
// Message Constants
69+
protected const MULTITON_MSG : String = "multitonKey for this Notifier not yet initialized!";
70+
6471
}
6572
}

0 commit comments

Comments
 (0)