this is my first post to this group. Forgive me if this is not the right place
to post this, but
it seems like this is a more approriate place for this specific question than
flexcoders and
such.
I'm looking for some feedback regarding a component. set I am developing. There
are 3
different aspects to the components:
-custom UI components
-widgets (which are comprised mostly of the various UI components just
mentioned)
-data components ( a service api, and stat tracking api).
As mentioned, widgets can be comprised of any number of different components.
Most,
but not all, of these components need to make calls through the service to
fetch and/or
send data.
The issue I'm having is that the UI Components will be added to the widgets
dynamically
by users of a separate app...so I have no way of knowing which calls might need
to be
made through the service.
I hope this is all making sense so far.
My plan right now is to have each widget implement a main controller and the
service.
Then any components added to the widget will register with the controller, and
any time it
wants to load or send data it dispatches an event which the controller handles,
and
possibly provide callback functions on result/fault.
My other thought was to either make the service a singleton and/or give each UI
component access to it through a property of the component like 'api' or
something, and
just allow the component to make and handle the service calls. They'd be more
encapsulated this way, but something about it just doesn't feel right.
Any feedback is greatly appreciated.