open-consul/ui-v2/app/utils/dom/event-source
John Cowen f7e2bb0712 ui: Small EventSource additions (#5978)
1. EventSources now pass themselves thorugh to the run function as a
second argument. This enables the use of arrow functions along with the
EventSources API
`(configuration, source) => source.close()`. Order of arguments could
potentially be switched at a later date.
2. BlockingEventSources now let you pass an 'event' through at
instantation time. If you do this, the event will immediately be dispatched
once the EventSource is opened. The usecase for this is for 'unfreezing' cached
BlockingEvents. This makes it easier to provide a cache for
BlockingEventSources by caching its data rather than the entire
BlockingEventSource itself.

```
new BlockingEventSource(
  (config, source) => { /* something */ },
  {
    cursor: 1024, // this would also come from a cache
    currentEvent: getFromSomeSortOfCache(eventSourceId) //this is the new bit
  }
);

// more realistically

new BlockingEventSource(
  (config, source) => { return data.findSomething(slug, config) },
  getFromSomeSortOfCache(eventSourceId)
);

```
2019-09-04 08:35:05 +00:00
..
blocking.js ui: Small EventSource additions (#5978) 2019-09-04 08:35:05 +00:00
cache.js UI: Add EventSource ready for implementing blocking queries (#5070) 2019-05-01 18:22:06 +00:00
callable.js ui: Small EventSource additions (#5978) 2019-09-04 08:35:05 +00:00
index.js ui: Change vocab of ReopenableEventSource from 'reopen' to 'open' (#5973) 2019-09-04 08:35:02 +00:00
openable.js ui: Change vocab of ReopenableEventSource from 'reopen' to 'open' (#5973) 2019-09-04 08:35:02 +00:00
proxy.js ui: Change vocab of ReopenableEventSource from 'reopen' to 'open' (#5973) 2019-09-04 08:35:02 +00:00
resolver.js ui: Change vocab of ReopenableEventSource from 'reopen' to 'open' (#5973) 2019-09-04 08:35:02 +00:00
storage.js ui: Change vocab of ReopenableEventSource from 'reopen' to 'open' (#5973) 2019-09-04 08:35:02 +00:00