Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 2.52 KB

fromevent.md

File metadata and controls

55 lines (41 loc) · 2.52 KB

Rx.DOM.fromEvent(element, eventName, [selector], [useCapture])

Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList.

Arguments

  1. element (Any): The DOMElement, DOMNodeList to attach a listener.
  2. eventName (String): The event name to attach the observable sequence.
  3. [selector] (Function): A selector which takes the arguments from the event handler to produce a single item to yield on next.
  4. [useCapture] (Boolean): If true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. Events which are bubbling upward through the tree will not trigger a listener designated to use capture.

Returns

(Observable): An observable sequence of events from the specified element and the specified event.

Example

var input = document.querySelectorAll('table tr td');

var source = Rx.DOM.fromEvent(input, 'click');

var subscription = source.subscribe(
    function (x) {
        console.log('Next: Clicked!');
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: