Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

RxJS-DOM version 4.0.1

Latest
Compare
Choose a tag to compare
@mattpodwysocki mattpodwysocki released this 15 Aug 20:31
· 153 commits to master since this release

This release is a minor update from version 4.0.0 which includes support for [Server-Sent Events].

Server-Sent Events

Server-Sent Events are enable servers to push data to Web pages over HTTP or using dedicated server-push protocols through the window.EventSource object. This allows the browser to automatically receive events pushed from the server instead of long polling which we've seen in the past with XMLHttpRequest objects.

Now, we have the ability with rx.dom.js to convert an EventSource to an observable sequence.

// Not handling the open event
var source = Rx.DOM.fromEventSource('foo.php');

source.subscribe(function (e) {
  console.log('Received data: ' + e.data);
});

// Using an observer for the open
var observer = Rx.Observer.create(function (e) {
  console.log('Opening');
});

var source = Rx.DOM.fromEventSource('foo.php', observer);

source.subscribe(function (e) {
  console.log('Received data: ' + e.data);
});