Opened 15 years ago

Closed 13 years ago

#299 closed enhancement (wontfix)

Allow topic subscribers to get an event pre-subscription

Reported by: david Owned by: alex
Priority: high Milestone:
Component: Events Version: 0.2
Keywords: event topics Cc:
Blocked By: Blocking:


It'd be nice if there was a way for topics to be able to get notified on subscribe if a publisher published before the subscription. Confusing?...

// somewhere this happens:
dojo.event.topic.publish("foo", ...);

// then later...
dojo.event.topic.subscribe("foo", ...);

// it'd be nice to say "let me know about the last one"
dojo.event.topic.subscribe2("foo", ...);
// that would run immediately since we published before the subscription

The overhead may be too expensive to store the last call + arguments for all published events. If that's the case, I propose that we have a special kind of subscription, "let me know, but who cares what's on the wire", so you can at least get notified buy you don't care about any args.

dojo.event.topic.subscribeAlert("foo", function() {
  alert('foo ran at some point, maybe even before I subscribed!');

Change History (6)

comment:1 Changed 14 years ago by dylan

Component: GeneralEvents
Milestone: 0.5

this would be really nice to have... basically getting a history of messages sent to the topic

comment:2 Changed 13 years ago by tk

I agree... (if its to be had... now would be the time to have it (pre 0.9stable or atleast pre 1.0)


comment:3 Changed 13 years ago by alex

Milestone: 0.91.0

there are several possible use cases, the degenerate one being covered by dojo.Deferred in 0.9. We need a better use case to specialize topics for this.

comment:4 Changed 13 years ago by Adam Peller

Milestone: 1.0

comment:5 Changed 13 years ago by Adam Peller

sounds like Deferreds are good enough? Close?

comment:6 Changed 13 years ago by dylan

Resolution: wontfix
Status: newclosed

closing as Deferreds solve the most common use case.

Note: See TracTickets for help on using tickets.