Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

global observers

8 views
Skip to first unread message

rvj

unread,
Nov 9, 2006, 3:52:59 AM11/9/06
to

I have a nested xul application which means that some parts of the
application are loaded in xul iframes.
Top level functions can be called from xul iframes using top.functionname()

What I would like to do is set up observers for broadcaster variables
defined in top

top xul


<broadcasterset>
<broadcaster id="broadcast" />
</broadcasterset>

iframe xul

<element observes="top.broadcast" />

this doesn't seem to work

- should it ?

or is the syntax wrong?

or is there an application wide broadcast?


Nickolay Ponomarev

unread,
Nov 10, 2006, 12:15:47 PM11/10/06
to rvj, dev-te...@lists.mozilla.org
On 11/9/06, rvj <m...@rolemodels.net> wrote:
> I have a nested xul application which means that some parts of the
> application are loaded in xul iframes.
> Top level functions can be called from xul iframes using top.functionname()
>
> What I would like to do is set up observers for broadcaster variables
> defined in top
>
> iframe xul
>
> <element observes="top.broadcast" />
>
> this doesn't seem to work

Broadcasters only work within one document. You'll need to do some
scripting if you wish to do inter-document communication. There are
tools available if your code is privileged (like nsIObserverService or
a custom service) or you can implement some code to communicate
between frames manually.

Nickolay

rvj

unread,
Nov 13, 2006, 4:54:06 AM11/13/06
to
Just of interest

Given the simplicity of the "observes" method, do you think that extending
the basic "observes" method to refer to the top most document broadcaster
element would be possible (and simpler)?

<element observes="top.document.getElementById(('broadcast')" />


"Nickolay Ponomarev" <asqu...@gmail.com> wrote in message
news:mailman.691.11631789...@lists.mozilla.org...

Nickolay Ponomarev

unread,
Nov 13, 2006, 6:10:38 AM11/13/06
to rvj, dev-te...@lists.mozilla.org
On 11/13/06, rvj <m...@rolemodels.net> wrote:
> Just of interest
>
> Given the simplicity of the "observes" method, do you think that extending
> the basic "observes" method to refer to the top most document broadcaster
> element would be possible (and simpler)?
>
> <element observes="top.document.getElementById(('broadcast')" />
>
I don't think it's a common need to synchronize elements in different
documents to certain "parent" document.

There is template mechanism in XUL, which can be used to keep your UI
in multiple documents synchronized it from a common dataset.
Admittedly, templates are complicated, but the concept is there.

Nickolay

>
> "Nickolay Ponomarev" <asqu...@gmail.com> wrote in message
> news:mailman.691.11631789...@lists.mozilla.org...
> > On 11/9/06, rvj <m...@rolemodels.net> wrote:
> > > I have a nested xul application which means that some parts of the
> > > application are loaded in xul iframes.
> > > Top level functions can be called from xul iframes using
> top.functionname()
> > >
> > > What I would like to do is set up observers for broadcaster variables
> > > defined in top
> > >
> > > iframe xul
> > >
> > > <element observes="top.broadcast" />
> > >
> > > this doesn't seem to work
> >
> > Broadcasters only work within one document. You'll need to do some
> > scripting if you wish to do inter-document communication. There are
> > tools available if your code is privileged (like nsIObserverService or
> > a custom service) or you can implement some code to communicate
> > between frames manually.
> >
> > Nickolay
>
>

> _______________________________________________
> dev-tech-xul mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xul
>

rvj

unread,
Nov 15, 2006, 3:24:07 AM11/15/06
to
The purpose of observers is to apply an attribute state of a large number of
elements (ideally in multiple documents) so that css selectors can kick in .

I guess the "simplest" solution is to use the onchange event on a common
datasource to trigger a reset of the same broadcast variable attribute in
each document.

thanks

ail.com> wrote in message
news:mailman.849.11634162...@lists.mozilla.org...

Nickolay Ponomarev

unread,
Jan 23, 2007, 9:21:18 AM1/23/07
to rvj, dev-te...@lists.mozilla.org
On 11/15/06, rvj <m...@rolemodels.net> wrote:
> The purpose of observers is to apply an attribute state of a large number of
> elements (ideally in multiple documents) so that css selectors can kick in .
>
> I guess the "simplest" solution is to use the onchange event on a common
> datasource to trigger a reset of the same broadcast variable attribute in
> each document.
>
FWIW, Neil Deakin has a spec
http://xulplanet.com/ndeakin/xul/specs/appstorage.html which provides
a way to easily listen for changes in an app-wide datasource.

Nickolay

0 new messages