cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse <purplecabb...@gmail.com>
Subject Sticky Channels
Date Fri, 05 Jun 2015 23:18:30 GMT
I have been looking into unifying launchParameters across devices so that
all cordova apps can get some context of how they were launched/activated.
This includes everything from a url/protocol launch in another app, to a
touch on a notification (toast,local,push,... )

My intent was to add a channel for this, however I have had some issues
with channels + stickiness.

I wanted a channel that would call new subscribers immediately if it had
already fired.  In our channel implementation this is what we call a sticky
channel.  However, this particular channel may fire more than once, ie. we
could be activated multiple times while running, or receive multiple
notifications.
The current implementation for sticky will only ever call subscribers once,
and if I call fire() more than once, it actually removes it's subscribers.
[1] So I cannot use this as is for my needs.

So my questions are :
1. Why is like this? Is there some standard or expectation that this is
based on?
2. Can I change it? What would be the impact of changing the behavior to
have a sticky channel fire more than once, and keep its list of subscribers?
3. Are there historical reasons that things are the way they are? The code
has been through several major moves since it was written, so it is
difficult to pin the original commit (Fil, Andrew? some merged pr?)  If
there are historical reasons, are they still relevant?

Please keep in mind too that I am not asking for the solution to my
specific task, I can work around anything ... I am asking solely about the
current channel-sticky implementation and it we should change it.

Cheers,
  Jesse


The current implementation
[1]
https://github.com/apache/cordova-js/blob/master/src/common/channel.js#L216


@purplecabbage
risingj.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message