Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Newbie Question - User - singleton?  (Read 5847 times)
martypitt
Courseware Beta
Newbie
***
Posts: 5


View Profile Email
« on: December 03, 2007, 11:25:05 »

Hi

I have a fairly simple question.... Across my application, various components need to know about who the user is.

How do I expose this type of singleton style data?  Do I expose a :

public function get userProxy():UserProxy

on the ApplicationFacade?

then when I need to know who the user is, I target ApplicationFacade.getInstance.userProxy.userName()?

Or is there a more appropriate approach?

Thanks


Marty
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: December 04, 2007, 07:09:06 »

This sounds like your planning to bind to this expression.

But bindig isn't available everywhere PureMVC is so binding in a PureMVC app is pretty much limited to blackbox wiring *inside* a view component.

We use a Mediator to connect a view component to its data by retrieving the reference from the Proxy and setting it on the view component in question.

-=Cliff>
Logged
martypitt
Courseware Beta
Newbie
***
Posts: 5


View Profile Email
« Reply #2 on: December 06, 2007, 02:33:16 »

Thanks Cliff
Logged
cliffrowley
Courseware Beta
Newbie
***
Posts: 2


View Profile Email
« Reply #3 on: December 21, 2007, 01:24:21 »

I don't know if this is strictly related, but I use a ProxyHelper class which exposes Proxy instances for me as a convenience.  Then I can reduce:

var proxy:SomeProxy = facade.retrieveProxy(SomeProxy.NAME) as SomeProxy;

to

var proxy:SomeProxy = ProxyHelper.getSomeProxy();
Logged
Pages: [1]
Print