In ubervu.com Single Page App we have a custom ApplicationController that creates default channels available throughout the lifecycle of the application. It's becoming really cumbersome to propagate these global channels (a few of them, really) to widget nested deeply within.
We need a quick and easy way for widgets to subscribe to these channels.
Deliverables
an API for creating / retrieving a global channel:
class GlobalChannels
create: (alias, type, params) ->
###
Creates a global channel of the given type with the given params under the
given alias. Global channels will have the "eternal" flag on - a.k.a. they will
never be garbage collected even though there are no widgets subscribed to
them.
The channel_alias -> channel_id mapping should be stored in the Mozaic
global object. The result of the function is the channel id of the newly created
channel because we might need to use it right away.
###
return
get: (alias) ->
###
Retrieve a global channel id for a given alias, or return None if no channel with
that alias was found.
We should discourage widgets from using this API in order to increase their
reusability. Therefore, this will be called only by the DataSource.
####
make the creation of global channels an official feature of Mozaic by default
enable a syntax like:
Utils.inject('widget',
params:
channels:
'/social_profiles': 'GLOBAL/social_profiles_for_posting' # social_profiles_for_posting is the alias of the global channel
Then datasource will check the id of the channels it receives and transforms them for all operations.
Notes
This is a long-standing request but it must be handled with care: we must not break Mozaic's best feature, forcing widgets to be reusable through the programming model. Therefore,
Need
In ubervu.com Single Page App we have a custom ApplicationController that creates default channels available throughout the lifecycle of the application. It's becoming really cumbersome to propagate these global channels (a few of them, really) to widget nested deeply within.
We need a quick and easy way for widgets to subscribe to these channels.
Deliverables
Then datasource will check the id of the channels it receives and transforms them for all operations.
Notes
This is a long-standing request but it must be handled with care: we must not break Mozaic's best feature, forcing widgets to be reusable through the programming model. Therefore,