├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jamignore ├── .jshintrc ├── .npmignore ├── .nuget ├── nuget.config ├── nuget.exe └── nuget.targets ├── .travis.yml ├── Gruntfile.js ├── authors.txt ├── bower.json ├── component.json ├── dist ├── rx.dom.compat.js ├── rx.dom.compat.map ├── rx.dom.compat.min.js ├── rx.dom.js ├── rx.dom.map └── rx.dom.min.js ├── doc ├── operators │ ├── ajax.md │ ├── blur.md │ ├── change.md │ ├── click.md │ ├── contextmenu.md │ ├── dblclick.md │ ├── error.md │ ├── filereader.md │ ├── focus.md │ ├── focusin.md │ ├── focusout.md │ ├── fromevent.md │ ├── fromeventsource.md │ ├── frommutationobserver.md │ ├── fromwebsocket.md │ ├── fromworker.md │ ├── get.md │ ├── getcurrentposition.md │ ├── getjson.md │ ├── input.md │ ├── jsonprequest.md │ ├── keydown.md │ ├── keypress.md │ ├── keyup.md │ ├── load.md │ ├── mousedown.md │ ├── mouseenter.md │ ├── mouseleave.md │ ├── mousemove.md │ ├── mouseout.md │ ├── mouseover.md │ ├── mouseup.md │ ├── pointerdown.md │ ├── pointerenter.md │ ├── pointerleave.md │ ├── pointermove.md │ ├── pointerout.md │ ├── pointerover.md │ ├── pointerup.md │ ├── post.md │ ├── ready.md │ ├── resize.md │ ├── scroll.md │ ├── select.md │ ├── submit.md │ ├── touchcancel.md │ ├── touchend.md │ ├── touchmove.md │ ├── touchstart.md │ ├── unload.md │ └── watchposition.md ├── readme.md └── schedulers │ ├── microtaskscheduler.md │ └── requestanimationframescheduler.md ├── examples ├── Autocomplete │ ├── Autocomplete.html │ └── autocomplete.js ├── CORS │ ├── index.html │ └── index.js ├── CanvasPaint │ ├── canvaspaint.css │ ├── canvaspaint.html │ └── canvaspaint.js ├── KonamiCode │ ├── KonamiCode.html │ └── konamicode.js ├── RequestAnimationFrame │ ├── draw.css │ ├── draw.html │ └── draw.js ├── TimeFlies │ ├── TimeFlies.html │ ├── timeflies.css │ └── timeflies.js ├── dragndrop │ ├── dragndrop.css │ ├── dragndrop.html │ ├── dragndrop.js │ └── logo.png ├── mutationobserver │ ├── mutationobserverscheduler.html │ └── mutationobserverscheduler.js ├── readme.md └── vendor │ ├── bootstrap-3.2.0 │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ └── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── js │ │ ├── bootstrap.js │ │ └── bootstrap.min.js │ ├── excanvas │ └── excanvas_src.js │ ├── html5shiv-3.7.2 │ └── html5shiv.min.js │ └── respond-1.4.2 │ └── respond.min.js ├── index.js ├── license.txt ├── modules ├── lite-ajax-compat │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.ajax.compat.js │ ├── rx.lite.dom.ajax.compat.map │ └── rx.lite.dom.ajax.compat.min.js ├── lite-ajax │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.ajax.js │ ├── rx.lite.dom.ajax.map │ └── rx.lite.dom.ajax.min.js ├── lite-compat │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.compat.js │ ├── rx.lite.dom.compat.map │ └── rx.lite.dom.compat.min.js ├── lite-concurrency │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.concurrency.js │ ├── rx.lite.dom.concurrency.map │ └── rx.lite.dom.concurrency.min.js ├── lite-events-compat │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.events.compat.js │ ├── rx.lite.dom.events.compat.map │ └── rx.lite.dom.events.compat.min.js ├── lite-events │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.events.js │ ├── rx.lite.dom.events.map │ └── rx.lite.dom.events.min.js ├── lite-html │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.html.js │ ├── rx.lite.dom.html.map │ └── rx.lite.dom.html.min.js ├── lite │ ├── package.json │ ├── readme.md │ ├── rx.lite.dom.js │ ├── rx.lite.dom.map │ └── rx.lite.dom.min.js ├── main-ajax │ ├── package.json │ ├── readme.md │ ├── rx.dom.ajax.compat.map │ ├── rx.dom.ajax.js │ ├── rx.dom.ajax.map │ └── rx.dom.ajax.min.js ├── main-concurrency │ ├── package.json │ ├── readme.md │ ├── rx.dom.concurrency.js │ ├── rx.dom.concurrency.map │ └── rx.dom.concurrency.min.js ├── main-events │ ├── package.json │ ├── readme.md │ ├── rx.dom.events.js │ ├── rx.dom.events.map │ └── rx.dom.events.min.js ├── main-html │ ├── package.json │ ├── readme.md │ ├── rx.dom.html.js │ ├── rx.dom.html.map │ └── rx.dom.html.min.js ├── publish.js └── version.js ├── nuget └── RxJS-Bridges-HTML │ └── RxJS-Bridges-HTML.nuspec ├── package.json ├── readme.md ├── src ├── ajax │ ├── ajax.js │ └── jsonp.js ├── concurrency │ ├── microtaskscheduler.js │ └── requestanimationframescheduler.js ├── dom │ ├── eventsource.js │ ├── fromreader.js │ ├── geolocation.js │ ├── mutationobserver.js │ ├── websocket.js │ └── worker.js ├── events │ ├── events.js │ ├── fromevent.js │ └── ready.js ├── headers │ ├── header.ajax.js │ ├── header.concurrency.js │ ├── header.events.js │ ├── header.html.js │ ├── header.js │ ├── intro.compat.js │ ├── intro.js │ ├── intro.lite.compat.js │ ├── intro.lite.js │ ├── license.js │ └── outro.js └── internal │ └── trycatch.js └── tests ├── ajax ├── tests.ajax.js └── tests.jsonp.js ├── concurrency ├── tests.microtaskscheduler.js └── tests.requestanimationframescheduler.js ├── dom ├── tests.eventsource.js ├── tests.filereader.js ├── tests.geolocation.js ├── tests.mutationobserver.js ├── tests.websocket.js └── tests.worker.js ├── events └── tests.events.js ├── helpers ├── btoa.js └── reactiveassert.js ├── rx.dom.compat.html ├── rx.dom.html └── vendor ├── qunit-1.9.0.css ├── qunit-1.9.0.js ├── sinon-1.7.3.js └── sinon-ie-1.7.3.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = false 6 | indent_style = space 7 | indent_size = 2 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | *.png -text 3 | *.exe -text 4 | *.jpg -text 5 | *.txt -text 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | bower_components -------------------------------------------------------------------------------- /.jamignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.bat 3 | *.md 4 | *.min.* 5 | *.txt 6 | *.log 7 | package.json 8 | node_modules 9 | doc 10 | examples 11 | src 12 | tests -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "node": true, 14 | "es5": true 15 | } -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /npm-debug.log 3 | /modules/ 4 | /content/ 5 | /tests/ 6 | /.jshintrc 7 | /.npmignore 8 | /src/ 9 | -------------------------------------------------------------------------------- /.nuget/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reactive-Extensions/RxJS-DOM/35271e7ddd7e68838d181beae3cee696b657f7f4/.nuget/nuget.exe -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.10" 4 | - "0.12" 5 | - 4 6 | - iojs 7 | notifications: 8 | slack: reactivex:e424dAgQ2W9kuRMe6ngxHQbv 9 | webhooks: 10 | urls: 11 | - https://webhooks.gitter.im/e/8f1482d7420d95b647ce 12 | on_success: change # options: [always|never|change] default: always 13 | on_failure: always # options: [always|never|change] default: always 14 | on_start: false # default: false 15 | -------------------------------------------------------------------------------- /authors.txt: -------------------------------------------------------------------------------- 1 | Matthew Podwysocki 2 | Bart de Smet 3 | Erik Meijer -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rxjs-dom", 3 | "main": [ 4 | "dist/rx.dom.js", 5 | "dist/rx.dom.compat.js" 6 | ], 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 10 | }, 11 | "license": "Apache-2.0", 12 | "dependencies": { 13 | "rxjs": "*" 14 | }, 15 | "ignore": [ 16 | ".*", 17 | "*.bat", 18 | "*.md", 19 | "*.min.*", 20 | "*.txt", 21 | "*.log", 22 | "package.json", 23 | "node_modules", 24 | "doc", 25 | "examples", 26 | "src", 27 | "tests" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-dom", 3 | "scripts": [ 4 | "dist/rx.dom.js", 5 | "dist/rx.dom.map", 6 | "dist/rx.dom.min.js", 7 | "dist/rx.dom.compat.js", 8 | "dist/rx.dom.compat.map", 9 | "dist/rx.dom.compat.min.js" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /doc/operators/blur.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.blur(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `blur` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `blur` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.blur(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/change.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.change(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `change` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `change` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.change(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('changed!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/click.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.click(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `click` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `click` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.click(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('clicked!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/contextmenu.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.contextmenu(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `contextmenu` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `contextmenu` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.contextmenu(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/dblclick.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.dblclick(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `dblclick` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `dblclick` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.dblclick(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/error.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.error(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `error` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### error 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `dblclick` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = window; 18 | 19 | var source = Rx.DOM.error(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/filereader.md: -------------------------------------------------------------------------------- 1 | `Rx.DOM.fromReader(file, [progressObserver])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/fromreader.js "View in source") 3 | 4 | The FileReader object lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read as an observable sequence. 5 | 6 | #### Arguments 7 | 1. `file` *(`File | Blob`)*: The file to read. 8 | 2. `[progressObserver]` *(`Rx.Observer`)*: An optional `Observer` to watch for progress events. 9 | 10 | #### Returns 11 | *(Object)*: An object which has the following functions: 12 | - `asArrayBuffer()` - *(`Rx.Observable`)*: This method is used to read the file as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBuffer) as an Observable stream. 13 | - `asBinaryString()` - *(`Rx.Observable`)*: This method is used to read the file as a binary data string as an Observable stream. 14 | - `asDataURL()` - *(`Rx.Observable`)*: This method is used to read the file as a URL of the file's data as an Observable stream. 15 | - `asText(encoding)` - *(`Rx.Observable`)*: This method is used to read the file as a string as an Observable stream. 16 | 17 | #### Example 18 | 19 | Read the contents of the file picker only if plain files: 20 | ```js 21 | Rx.DOM.change(filesInput) 22 | .flatMap(function (event) { 23 | return Rx.Observable.from(event.target.files); 24 | }) 25 | .filter(function (file) { 26 | return file.type.match('plain'); 27 | }) 28 | .flatMap(function (file) { 29 | return Rx.DOM.fromReader(file).asText(); 30 | }) 31 | .subscribe(function (contents) { 32 | console.log(contents); 33 | }); 34 | ``` 35 | 36 | ### Location 37 | 38 | File: 39 | - [`/src/dom/fromreader.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/fromreader.js) 40 | 41 | Dist: 42 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) 43 | 44 | Prerequisites: 45 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/dom/tests.filereader.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/dom/tests.filereader.js) 55 | -------------------------------------------------------------------------------- /doc/operators/focus.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.focus(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `focus` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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 10 | *(`Observable`)*: An observable sequence of events from the specified element and the `focus` event. 11 | 12 | #### Example 13 | 14 | ```js 15 | var input = document.getElementById('input'); 16 | 17 | var source = Rx.DOM.focus(input); 18 | 19 | var subscription = source.subscribe( 20 | function (x) { 21 | console.log('Next!'); 22 | }, 23 | function (err) { 24 | console.log('Error: ' + err); 25 | }, 26 | function () { 27 | console.log('Completed'); 28 | }); 29 | ``` 30 | 31 | ### Location 32 | 33 | File: 34 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 35 | 36 | Dist: 37 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 38 | 39 | Prerequisites: 40 | - If using `rx.js` 41 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 42 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 43 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 44 | 45 | NPM Packages: 46 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 47 | 48 | NuGet Packages: 49 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 50 | 51 | Unit Tests: 52 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 53 | -------------------------------------------------------------------------------- /doc/operators/focusin.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.focusin(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `focusin` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `focusin` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.focusin(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/focusout.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.focusout(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `focusout` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `focusout` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.focusout(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/fromevent.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.fromEvent(element, eventName, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/fromevent.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `eventName` *(`String`)*: The event name to attach the observable sequence. 9 | 3. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 10 | 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. 11 | 12 | #### Returns 13 | *(`Observable`)*: An observable sequence of events from the specified element and the specified event. 14 | 15 | #### Example 16 | 17 | ```js 18 | var input = document.querySelectorAll('table tr td'); 19 | 20 | var source = Rx.DOM.fromEvent(input, 'click'); 21 | 22 | var subscription = source.subscribe( 23 | function (x) { 24 | console.log('Next: Clicked!'); 25 | }, 26 | function (err) { 27 | console.log('Error: ' + err); 28 | }, 29 | function () { 30 | console.log('Completed'); 31 | }); 32 | ``` 33 | 34 | ### Location 35 | 36 | File: 37 | - [`/src/fromevent.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/fromevent.js) 38 | 39 | Dist: 40 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 41 | 42 | Prerequisites: 43 | - If using `rx.js` 44 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 45 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 46 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 47 | 48 | NPM Packages: 49 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 50 | 51 | NuGet Packages: 52 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 53 | 54 | Unit Tests: 55 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/tests.fromevent.js) 56 | -------------------------------------------------------------------------------- /doc/operators/fromeventsource.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.fromEventSource(url, [openObserver])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/eventsource.js "View in source") 3 | 4 | This method wraps an EventSource as an observable sequence which is used to send server-side events. Note that your browser must support EventSource objects. 5 | 6 | #### Arguments 7 | 1. `url` *(String)*: The URL of the Server-Side Events. 8 | 3. `[openObserver]` *(`Rx.Observer`)*: An optional Observer to capture the open event. 9 | 10 | #### Returns 11 | *(`Observable`)*: An observable sequence which represents the data from a server-side event. 12 | 13 | #### Example 14 | ```js 15 | // Not handling the open event 16 | var source = Rx.DOM.fromEventSource('foo.php'); 17 | 18 | source.subscribe(function (e) { 19 | console.log('Received data: %s', e.data); 20 | }); 21 | 22 | // Using an observer for the open 23 | var observer = Rx.Observer.create(function (e) { 24 | console.log('Opening'); 25 | }); 26 | 27 | var source = Rx.DOM.fromEventSource('foo.php', observer); 28 | 29 | source.subscribe(function (e) { 30 | console.log('Received data: ' + e.data); 31 | }); 32 | ``` 33 | 34 | ### Location 35 | 36 | File: 37 | - [`/src/dom/eventsource.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/eventsource.js) 38 | 39 | Dist: 40 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) 41 | 42 | Prerequisites: 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) 44 | 45 | NPM Packages: 46 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 47 | 48 | NuGet Packages: 49 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 50 | 51 | Unit Tests: 52 | - [`/tests/dom/tests.eventsource.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/dom/tests.eventsource.js) 53 | -------------------------------------------------------------------------------- /doc/operators/frommutationobserver.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.fromMutationObserver(target, options)` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/mutationobserver.js "View in source") 3 | 4 | Creates an observable sequence from a `MutationObserver`. The `MutationObserver` provides developers a way to react to changes in a DOM. This requires `MutationObserver` to be supported in your browser/JavaScript runtime. 5 | 6 | #### Arguments 7 | 1. `target` *(Node)*: The Node on which to observe DOM mutations. 8 | 2. `options` *(MutationObserverInit)*: A [`MutationObserverInit`](http://msdn.microsoft.com/en-us/library/windows/apps/dn252345.aspx) object, specifies which DOM mutations should be reported. 9 | 10 | #### Returns 11 | *(Observable)*: An observable sequence which contains mutations on the given DOM target. 12 | 13 | #### Example 14 | ```js 15 | var foo = document.getElementById('foo'); 16 | 17 | var obs = Rx.DOM.fromMutationObserver(foo, { 18 | attributes: true, 19 | childList: true, 20 | characterData: true, 21 | attributeFilter: ["id", "dir"], 22 | attributeOldValue: true 23 | }); 24 | 25 | foo.dir = 'rtl'; 26 | 27 | // Listen for mutations 28 | obs.subscribe(function (mutations) { 29 | mutations.forEach(function(mutation) { 30 | console.log("Type of mutation: " + mutation.type); 31 | 32 | if ("attributes" === mutation.type) { 33 | console.log("Old attribute value: " + mutation.oldValue); 34 | } 35 | }); 36 | }); 37 | ``` 38 | 39 | ### Location 40 | 41 | File: 42 | - [`/src/dom/mutationobserver.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/mutationobserver.js) 43 | 44 | Dist: 45 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) 46 | 47 | Prerequisites: 48 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) 49 | 50 | NPM Packages: 51 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 52 | 53 | NuGet Packages: 54 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 55 | 56 | Unit Tests: 57 | - [`/tests/dom/tests.mutationobserver.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/dom/tests.mutationobserver.js) 58 | -------------------------------------------------------------------------------- /doc/operators/fromwebsocket.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.fromWebSocket(url, protocol, [openObserver], [closeObserver])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/websocket.js "View in source") 3 | 4 | Creates a WebSocket Subject with a given URL, protocol and an optional observer for the open event and for close. 5 | 6 | #### Arguments 7 | 1. `url` *(String)*: The URL of the WebSocket. 8 | 2. `protocol` *(String)*: The protocol of the WebSocket. 9 | 3. `openObserver` *(`Rx.Observer`)*: An optional Observer to capture the open event. 10 | 4. `closingObserver` *(`Rx.Observer`)*: An optional Observer capture the the moment before the underlying socket is closed. 11 | 12 | #### Returns 13 | *(`Subject`)*: A Subject which wraps a WebSocket. 14 | 15 | #### Example 16 | ```js 17 | // an observer for when the socket is open 18 | var openObserver = Rx.Observer.create(function(e) { 19 | console.info('socket open'); 20 | 21 | // Now it is safe to send a message 22 | socket.onNext('test'); 23 | }); 24 | 25 | // an observer for when the socket is about to close 26 | var closingObserver = Rx.Observer.create(function() { 27 | console.log('socket is about to close'); 28 | }); 29 | 30 | // create a web socket subject 31 | socket = Rx.DOM.fromWebSocket( 32 | 'ws://echo.websocket.org', 33 | null, // no protocol 34 | openObserver, 35 | closingObserver); 36 | 37 | // subscribing creates the underlying socket and will emit a stream of incoming 38 | // message events 39 | socket.subscribe( 40 | function(e) { 41 | console.log('message: %s', e.data); 42 | }, 43 | function(e) { 44 | // errors and "unclean" closes land here 45 | console.error('error: %s', e); 46 | }, 47 | function() { 48 | // the socket has been closed 49 | console.info('socket closed'); 50 | } 51 | ); 52 | ``` 53 | 54 | ### Location 55 | 56 | File: 57 | - [`/src/dom/websocket.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/websocket.js) 58 | 59 | Dist: 60 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) 61 | 62 | Prerequisites: 63 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) 64 | 65 | NPM Packages: 66 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 67 | 68 | NuGet Packages: 69 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 70 | 71 | Unit Tests: 72 | - [`/tests/tests.websocket.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/tests.fromwebsocket.js) 73 | -------------------------------------------------------------------------------- /doc/operators/fromworker.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.fromWorker(url)` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/worker.js "View in source") 3 | Creates a Web Worker with a given URL as a Subject. 4 | 5 | #### Arguments 6 | 1. `url` *(`String`)*: The URL of the Web Worker. 7 | 8 | #### Returns 9 | *(`Subject`)*: A Subject which wraps a Web Worker. 10 | 11 | #### Example 12 | ```js 13 | var worker = Rx.DOM.fromWebWorker('worker.js'); 14 | 15 | worker.subscribe(function (e) { 16 | console.log(e.data); 17 | }); 18 | 19 | worker.onNext('some data'); 20 | ``` 21 | 22 | ### Location 23 | 24 | File: 25 | - [`/src/dom/worker.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/dom/worker.js) 26 | 27 | Dist: 28 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) 29 | 30 | Prerequisites: 31 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) 32 | 33 | NPM Packages: 34 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 35 | 36 | NuGet Packages: 37 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 38 | 39 | Unit Tests: 40 | - [`/tests/dom/tests.worker.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/dom/tests.worker.js) 41 | -------------------------------------------------------------------------------- /doc/operators/get.md: -------------------------------------------------------------------------------- 1 | ### Rx.DOM.ajax.get(url)` 2 | ### Rx.DOM.ajax.get(settings)` 3 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax/ajax.js "View in source") 4 | 5 | Creates an observable sequence from an Ajax GET Request with the body. This is just a shortcut to the [`Rx.DOM.ajax`](ajax.md) method with the GET method. 6 | 7 | #### Arguments 8 | - `url` *(String)*: A string of the URL to make the Ajax call. 9 | 10 | OR 11 | 12 | - `settings` *(Object)*: An object with the following properties: 13 | 14 | - `async` *(Boolean)*: Whether the request is async. The default is `true`. 15 | - `body` *(Object)*: Optional body 16 | - `crossDomain` *(Boolean)*: true if to use CORS, else false. The default is `false`. 17 | - `headers` *(Object)*: Optional headers 18 | - `password` *(String)*: The password for the request. 19 | - `progressObserver` *(Observer)*: An optional `Observer` which listen to XHR2 progress events. 20 | - `responseType` *(String)*: The response type. Either can be 'json' or 'text'. The default is 'text' 21 | - `url` *(String)*: URL of the request 22 | - `user` *(String)*: The user for the request. 23 | 24 | #### Returns 25 | *(Observable)*: The observable sequence which contains the response from the Ajax GET. 26 | 27 | #### Example 28 | ```js 29 | Rx.DOM.get('/products') 30 | .subscribe( 31 | function (data) { 32 | var text = data.response; 33 | console.log(text); 34 | }, 35 | function (err) { 36 | // Log the error 37 | } 38 | ); 39 | ``` 40 | 41 | ### Location 42 | 43 | File: 44 | - [`/src/ajax.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax/ajax.js) 45 | 46 | Dist: 47 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 48 | 49 | Prerequisites: 50 | - If using `rx.js` 51 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 52 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 53 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 54 | 55 | NPM Packages: 56 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 57 | 58 | NuGet Packages: 59 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 60 | 61 | Unit Tests: 62 | - [`/tests/ajax/tests.ajax.js](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/ajax/tests.ajax.js) 63 | -------------------------------------------------------------------------------- /doc/operators/getjson.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.getJSON(url)` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax/ajax.js "View in source") 3 | 4 | Creates an observable sequence from JSON from an Ajax request. This is just a shortcut to the [`Rx.DOM.ajax`](ajax.md) method with the GET method and parsing the `responseText` as JSON. 5 | 6 | #### Arguments 7 | 1. `url` *(String)*: A string of the URL to make the Ajax call. 8 | 9 | #### Returns 10 | *(Observable)*: The observable sequence which contains the parsed JSON. 11 | 12 | #### Example 13 | ```js 14 | Rx.getJSON('/products') 15 | .subscribe( 16 | function (data) { 17 | // Log data length 18 | console.log(data.length); 19 | }, 20 | function (err) { 21 | // Log the error 22 | } 23 | ); 24 | ``` 25 | 26 | ### Location 27 | 28 | File: 29 | - [`/src/ajax.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax.js) 30 | 31 | Dist: 32 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 33 | 34 | Prerequisites: 35 | - If using `rx.js` 36 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 37 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 38 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 39 | 40 | NPM Packages: 41 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 42 | 43 | NuGet Packages: 44 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 45 | 46 | Unit Tests: 47 | - [`/tests/ajax/tests.ajax.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/ajax/tests.ajax.js) 48 | -------------------------------------------------------------------------------- /doc/operators/input.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.input(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `input` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `input` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.input(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Input changed!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/keydown.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.keydown(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `keydown` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `keydown` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.keydown(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('clicked!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/keypress.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.keypress(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `keypress` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `keypress` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.keypress(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/keyup.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.keyup(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `keyup` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `keyup` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.keyup(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/load.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.load(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `load` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `load` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.load(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/mousedown.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.mousedown(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `mousedown` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `mousedown` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.mousedown(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('clicked!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/mouseenter.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.mouseenter(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `mouseenter` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `mouseenter` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.mouseenter(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/mouseleave.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.mouseleave(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `mouseleave` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `mouseleave` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.mouseleave(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/mousemove.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.mousemove(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `mousemove` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `mousemove` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.mousemove(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/mouseout.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.mouseout(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `mouseout` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `mouseout` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.mouseout(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/mouseover.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.mouseover(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `mouseover` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `mouseover` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.mouseover(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/mouseup.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.mouseup(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `mouseup` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `mouseup` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.mouseup(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/pointerdown.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.pointerdown(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `pointerdown` event. This method is only available when Pointer Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `pointerdown` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.pointerdown(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/pointerenter.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.pointerenter(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `pointerenter` event. This method is only available when Pointer Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `pointerenter` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.pointerenter(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/pointerleave.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.pointerleave(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `pointerleave` event. This method is only available when Pointer Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `pointerleave` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.pointerleave(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/pointermove.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.pointermove(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `pointermove` event. This method is only available when Pointer Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `pointermove` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.pointermove(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/pointerout.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.pointerout(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `pointerout` event. This method is only available when Pointer Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `pointerout` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.pointerout(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/pointerover.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.pointerover(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `pointerover` event. This method is only available when Pointer Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `pointerover` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.pointerover(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/pointerup.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.pointerup(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `pointerup` event. This method is only available when Pointer Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `pointerup` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.pointerup(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/post.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.post(url, [body])` 2 | ### `Rx.DOM.post(settings)` 3 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax/ajax.js "View in source") 4 | 5 | Creates an observable sequence from an Ajax POST Request with the body. This is just a shortcut to the [`Rx.DOM.ajax`](ajax.md) method with the POST method. 6 | 7 | #### Arguments 8 | - `url` *(String)*: A string of the URL to make the Ajax call. 9 | - `[body]` *(Object)*: The body to post 10 | 11 | OR 12 | 13 | - `settings` *(Object)*: An object with the following properties: 14 | 15 | - `async` *(Boolean)*: Whether the request is async. The default is `true`. 16 | - `body` *(Object)*: Optional body 17 | - `crossDomain` *(Boolean)*: true if to use CORS, else false. The default is `false`. 18 | - `headers` *(Object)*: Optional headers 19 | - `password` *(String)*: The password for the request. 20 | - `progressObserver` *(Observer)*: An optional `Observer` which listen to XHR2 progress events. 21 | - `responseType` *(String)*: The response type. Either can be 'json' or 'text'. The default is 'text' 22 | - `url` *(String)*: URL of the request 23 | - `user` *(String)*: The user for the request. 24 | 25 | 26 | #### Returns 27 | *(Observable)*: The observable sequence which contains the response from the Ajax POST. 28 | 29 | #### Example 30 | ```js 31 | Rx.DOM.post('/test', { text: 'sometext' }) 32 | .subscribe( 33 | function (data) { 34 | console.log(data.response); 35 | }, 36 | function (err) { 37 | // Log the error 38 | } 39 | ); 40 | ``` 41 | 42 | ### Location 43 | 44 | File: 45 | - [`/src/ajax/ajax.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax/ajax.js) 46 | 47 | Dist: 48 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 49 | 50 | Prerequisites: 51 | - If using `rx.js` 52 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 53 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 54 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 55 | 56 | NPM Packages: 57 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 58 | 59 | NuGet Packages: 60 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 61 | 62 | Unit Tests: 63 | - [`/tests/ajax/tests.ajax.js](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/ajax/tests.ajax.js) 64 | -------------------------------------------------------------------------------- /doc/operators/ready.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.ready()` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ready.js "View in source") 3 | 4 | Creates an Observable sequence which fires when the DOM is fully loaded. 5 | 6 | While JavaScript provides the `load` event for executing code when a page is rendered, this event does not get triggered until all assets such as images have been completely received. In most cases, the script can be run as soon as the DOM hierarchy has been fully constructed. The handler passed to `.ready()` is guaranteed to be executed after the DOM is ready, so this is usually the best place to attach all other event handlers and run other jQuery code. When using scripts that rely on the value of CSS style properties, it's important to reference external stylesheets or embed style elements before referencing the scripts. 7 | 8 | In cases where code relies on loaded assets (for example, if the dimensions of an image are required), the code should be placed in a handler for the `load` event instead. 9 | 10 | #### Returns 11 | *(`Observable`)*: An observable sequence which fires when the DOM is fully loaded. 12 | 13 | #### Example 14 | 15 | ```js 16 | function initialize() { 17 | // Do something on initialization 18 | } 19 | 20 | Rx.DOM.ready().subscribe(initialize); 21 | ``` 22 | 23 | ### Location 24 | 25 | File: 26 | - [`/src/ready.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ready.js) 27 | - [`/src/ready.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ready.compat.js) 28 | 29 | Dist: 30 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 31 | 32 | Prerequisites: 33 | - If using `rx.js` 34 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 35 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 36 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 37 | 38 | NPM Packages: 39 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 40 | 41 | NuGet Packages: 42 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 43 | 44 | Unit Tests: 45 | - [`/tests/ready.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/ready.js) 46 | -------------------------------------------------------------------------------- /doc/operators/resize.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.resize(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `resize` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `resize` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.resize(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/scroll.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.scroll(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `scroll` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `scroll` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.scroll(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/select.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.select(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `select` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `select` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.select(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/submit.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.submit(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `submit` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `submit` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.submit(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/touchcancel.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.touchcancel(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `touchcancel` event. This method is only available when Touch Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `touchcancel` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.touchcancel(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/touchend.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.touchend(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `touchend` event. This method is only available when Touch Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `touchend` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.touchend(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/touchmove.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.touchmove(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `touchmove` event. This method is only available when Touch Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `touchmove` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.touchmove(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/touchstart.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.touchstart(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `touchstart` event. This method is only available when Touch Events are supported on the browser. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `touchstart` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.touchstart(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/operators/unload.md: -------------------------------------------------------------------------------- 1 | ### `Rx.DOM.unload(element, [selector], [useCapture])` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js "View in source") 3 | 4 | Creates an observable sequence by adding an event listener to the matching DOMElement or DOMNodeList for the `unload` event. 5 | 6 | #### Arguments 7 | 1. `element` *(`Any`)*: The DOMElement, DOMNodeList to attach a listener. 8 | 2. `[selector]` *(`Function`)*: A selector which takes the arguments from the event handler to produce a single item to yield on next. 9 | 3. `[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. 10 | 11 | #### Returns 12 | *(`Observable`)*: An observable sequence of events from the specified element and the `unload` event. 13 | 14 | #### Example 15 | 16 | ```js 17 | var input = document.getElementById('input'); 18 | 19 | var source = Rx.DOM.unload(input); 20 | 21 | var subscription = source.subscribe( 22 | function (x) { 23 | console.log('Next!'); 24 | }, 25 | function (err) { 26 | console.log('Error: ' + err); 27 | }, 28 | function () { 29 | console.log('Completed'); 30 | }); 31 | ``` 32 | 33 | ### Location 34 | 35 | File: 36 | - [`/src/events/events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/events/events.js) 37 | 38 | Dist: 39 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 40 | 41 | Prerequisites: 42 | - If using `rx.js` 43 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 44 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 45 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 46 | 47 | NPM Packages: 48 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 49 | 50 | NuGet Packages: 51 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 52 | 53 | Unit Tests: 54 | - [`/tests/events/tests.events.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/events/tests.events.js) 55 | -------------------------------------------------------------------------------- /doc/schedulers/microtaskscheduler.md: -------------------------------------------------------------------------------- 1 | ### `Rx.Scheduler.microtask` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/microtask.js "View in source") 3 | 4 | Gets an `Rx.Scheduler` that schedules work on the `window.MutationObserver` for immediate actions. If this is not available, this defaults to `window.setImmediate`, `window.postMessage`, `window.MessageChannel`, `script.onreadystatechanged` and finally `setTimeout` in that order based upon what your browser supports. 5 | 6 | #### Example 7 | ```js 8 | var obs = Rx.Observable.return( 9 | 42, 10 | Rx.Scheduler.mutationObserver); 11 | 12 | obs.subscribe(function (x) { 13 | // Scheduled using a MutationObserver 14 | console.log(x); 15 | }); 16 | 17 | // => 42 18 | ``` 19 | 20 | ### Location 21 | 22 | File: 23 | - [`/src/concurrency/microtaskscheduler.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/concurrency/microtaskscheduler.js) 24 | 25 | Dist: 26 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 27 | 28 | Prerequisites: 29 | - If using `rx.js` 30 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 31 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 32 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 33 | 34 | NPM Packages: 35 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 36 | 37 | NuGet Packages: 38 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 39 | 40 | Unit Tests: 41 | - [`/tests/concurrency/tests.microtaskscheduler.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/concurrency/tests.microtaskscheduler.js) 42 | -------------------------------------------------------------------------------- /doc/schedulers/requestanimationframescheduler.md: -------------------------------------------------------------------------------- 1 | ### `Rx.Scheduler.requestAnimationFrame` 2 | [Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/requestanimationframescheduler.js "View in source") 3 | 4 | Gets an `Rx.Scheduler` that schedules schedules work on the `window.requestAnimationFrame` for immediate actions and defaults to `window.setTimeout` if not available. 5 | 6 | #### Example 7 | ```js 8 | var obs = Rx.Observable.return( 9 | 42, 10 | Rx.Scheduler.requestAnimationFrame); 11 | 12 | obs.subscribe(function (x) { 13 | // Scheduled using requestAnimationFrame 14 | console.log(x); 15 | }); 16 | 17 | // => 42 18 | ``` 19 | 20 | ### Location 21 | 22 | File: 23 | - [`/src/requestanimationframescheduler.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/requestanimationframescheduler.js) 24 | 25 | Dist: 26 | - [`rx.dom.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.js) | - [`rx.dom.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/dist/rx.dom.compat.js) 27 | 28 | Prerequisites: 29 | - If using `rx.js` 30 | - [`rx.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.js) | [`rx.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.compat.js) 31 | - [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js) 32 | - [`rx.lite.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.js) | [`rx.lite.compat.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/rx.lite.compat.js) 33 | 34 | NPM Packages: 35 | - [`rx-dom`](https://preview.npmjs.com/package/rx-dom) 36 | 37 | NuGet Packages: 38 | - [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/) 39 | 40 | Unit Tests: 41 | - [`/tests/tests.requestanimationframescheduler.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/tests.requestanimationframescheduler.js) 42 | -------------------------------------------------------------------------------- /examples/Autocomplete/Autocomplete.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Rx for JavaScript Rocks! 10 | 11 | 15 | 16 | 17 | 18 |
19 | 23 |
24 |
25 |
26 | 27 | 28 |
29 |
30 |
31 |
32 |
    33 |
    34 |
    35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/Autocomplete/autocomplete.js: -------------------------------------------------------------------------------- 1 | ;(function (window, undefined) { 2 | 3 | function searchWikipedia (term) { 4 | var url = 'http://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=' 5 | + encodeURIComponent(term) + '&callback=JSONPCallback'; 6 | return Rx.DOM.jsonpRequest(url); 7 | } 8 | 9 | function clearChildren (e) { 10 | while (e.firstChild) { e.removeChild(e.firstChild); } 11 | } 12 | 13 | function createChildren(results, parent) { 14 | for (var i = 0, len = results.length; i < len; i++) { 15 | createElement(results[i], parent); 16 | } 17 | } 18 | 19 | function createElement(text, parent) { 20 | var li = document.createElement('li'); 21 | li.innerHTML = text; 22 | parent.appendChild(li); 23 | } 24 | 25 | function initialize () { 26 | var input = document.getElementById('textInput'), 27 | ul = document.getElementById('results'); 28 | 29 | var keyup = Rx.DOM.keyup(input) 30 | .map(function (ev) { return ev.target.value; }) 31 | .filter(function(text) { return text.length > 2; }) 32 | .debounce(500) 33 | .distinctUntilChanged(); 34 | 35 | var searcher = keyup.flatMapLatest(searchWikipedia).map(function(d) { return d.response[1]; }); 36 | 37 | searcher.subscribe( 38 | function (results) { 39 | clearChildren(ul); 40 | createChildren(results, ul); 41 | }, 42 | function (error) { 43 | clearChildren(ul); 44 | createElement('Error: ' + error.message, ul); 45 | } 46 | ); 47 | } 48 | 49 | Rx.DOM.ready().subscribe(initialize); 50 | }(window)); 51 | -------------------------------------------------------------------------------- /examples/CORS/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Rx for JavaScript Rocks! 10 | 11 | 15 | 16 | 17 |
    18 | 22 |
    23 |

    24 |
    25 |
    26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /examples/CORS/index.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | function getTitle(text) { 3 | return text.match('(.*)?')[1]; 4 | } 5 | 6 | function main() { 7 | var result = document.querySelector('#result'); 8 | 9 | var request = Rx.DOM.ajax({ 10 | url: 'http://updates.html5rocks.com', 11 | crossDomain: true, 12 | async: true 13 | }); 14 | 15 | request.subscribe( 16 | function (x) { 17 | result.textContent = 'Page Title: ' + getTitle(x.xhr.responseText); 18 | }, 19 | function (err) { 20 | result.textContent = 'Error response: ' + err; 21 | } 22 | ) 23 | } 24 | 25 | Rx.DOM.ready().subscribe(main); 26 | }()); 27 | -------------------------------------------------------------------------------- /examples/CanvasPaint/canvaspaint.css: -------------------------------------------------------------------------------- 1 | canvas { 2 | background-color: #cccccb; 3 | } 4 | 5 | html { 6 | -moz-user-select: none; 7 | -khtml-user-select: none; 8 | -webkit-user-select: none; 9 | user-select: none; 10 | } 11 | 12 | canvas { display: block; } -------------------------------------------------------------------------------- /examples/CanvasPaint/canvaspaint.js: -------------------------------------------------------------------------------- 1 | (function (window, undefined) { 2 | 3 | // Calcualte offset either layerX/Y or offsetX/Y 4 | function getOffset(event) { 5 | return { 6 | offsetX: event.offsetX === undefined ? event.layerX : event.offsetX, 7 | offsetY: event.offsetY === undefined ? event.layerY : event.offsetY 8 | }; 9 | } 10 | 11 | function intialize () { 12 | var canvas = document.getElementById('tutorial'); 13 | var colorchart = document.querySelectorAll('#colorchart tr td'); 14 | 15 | var ctx = canvas.getContext('2d'); 16 | ctx.beginPath(); 17 | 18 | // Get mouse events 19 | var mouseMoves = Rx.DOM.mousemove(canvas), 20 | mouseDowns = Rx.DOM.mousedown(canvas), 21 | mouseUps = Rx.DOM.mouseup(canvas), 22 | just = Rx.helpers.just; 23 | 24 | // Get the table events 25 | var colorValues = Rx.DOM.click(colorchart) 26 | .tap(function () { ctx.beginPath(); }) 27 | .map(function (e) { return e.target.bgColor; }) 28 | .startWith('#000000'); 29 | 30 | // Calculate difference between two mouse moves 31 | var mouseDiffs = mouseMoves.zip(mouseMoves.skip(1), function (x, y) { 32 | return { first: getOffset(x), second: getOffset(y) }; 33 | }); 34 | 35 | // Get merge together both mouse up and mouse down 36 | var mouseButton = mouseDowns.map(just(true)) 37 | .merge(mouseUps.map(just(false))); 38 | 39 | // Paint if the mouse is down 40 | var paint = mouseButton.flatMapLatest(function (down) { return down ? mouseDiffs : Rx.Observable.empty(); }) 41 | .combineLatest(colorValues, function (pos, color) { 42 | return { pos : pos, color: color }; 43 | }); 44 | 45 | // Update the canvas 46 | var subscription = paint.subscribe(function (x) { 47 | ctx.strokeStyle = x.color; 48 | ctx.moveTo(x.pos.first.offsetX, x.pos.first.offsetY); 49 | ctx.lineTo(x.pos.second.offsetX, x.pos.second.offsetY); 50 | ctx.stroke(); 51 | }); 52 | } 53 | 54 | Rx.DOM.ready().subscribe(intialize); 55 | }(window)); -------------------------------------------------------------------------------- /examples/KonamiCode/konamicode.js: -------------------------------------------------------------------------------- 1 | (function (window, undefined) { 2 | 3 | function fadeOut(element) { 4 | var opacity = 1; 5 | element.style.opacity = opacity; 6 | 7 | var subscription = Rx.Scheduler.timeout.scheduleRecursiveWithRelative(100, function (self) { 8 | if (opacity === 0) { 9 | subscription.dispose(); 10 | return; 11 | } 12 | 13 | opacity -= 0.1; 14 | element.style.opacity = opacity; 15 | self(100); 16 | }); 17 | } 18 | 19 | function initialize() { 20 | 21 | var codes = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65], 22 | konami = Rx.Observable.from(codes), 23 | result = document.getElementById('result'); 24 | 25 | Rx.DOM.keyup(document) 26 | .pluck('keyCode') 27 | .bufferWithCount(10, 1) 28 | .filter(function (data) { return data.toString() === codes.toString(); }) 29 | .subscribe(function () { 30 | result.innerHTML = 'KONAMI!'; 31 | fadeOut(result); 32 | }); 33 | } 34 | 35 | Rx.DOM.ready().subscribe(initialize); 36 | })(window); -------------------------------------------------------------------------------- /examples/RequestAnimationFrame/draw.css: -------------------------------------------------------------------------------- 1 | html { background: #000; } 2 | canvas { display: block; } -------------------------------------------------------------------------------- /examples/RequestAnimationFrame/draw.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Rx for JavaScript Rocks! 7 | 8 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/RequestAnimationFrame/draw.js: -------------------------------------------------------------------------------- 1 | (function (global) { 2 | var canvas, context, subscription; 3 | 4 | function init() { 5 | var host = document.body; 6 | 7 | canvas = document.createElement( 'canvas' ); 8 | 9 | // ie IE < 9 10 | if (typeof G_vmlCanvasManager !== 'undefined') { 11 | G_vmlCanvasManager.initElement(canvas); 12 | } 13 | 14 | canvas.width = 512; 15 | canvas.height = 512; 16 | 17 | context = canvas.getContext( '2d' ); 18 | 19 | host.appendChild( canvas ); 20 | } 21 | 22 | function animate() { 23 | subscription = Rx.Observable.generate( 24 | 0, 25 | function (x) { return true; }, 26 | function (x) { return x + 1; }, 27 | function (x) { return x; }, 28 | Rx.Scheduler.requestAnimationFrame 29 | ) 30 | .timestamp() 31 | .subscribe(draw); 32 | } 33 | 34 | function draw(ts) { 35 | 36 | var time = ts.timestamp * 0.002; 37 | var x = Math.sin( time ) * 192 + 256; 38 | var y = Math.cos( time * 0.9 ) * 192 + 256; 39 | 40 | context.fillStyle = ts.value % 2 === 0 ? 'rgb(200,200,20)' : 'rgb(20,20,200)'; 41 | context.beginPath(); 42 | context.arc( x, y, 10, 0, Math.PI * 2, true ); 43 | context.closePath(); 44 | context.fill(); 45 | } 46 | 47 | function main () { 48 | init(); 49 | animate(); 50 | } 51 | 52 | Rx.DOM.ready().subscribe(main); 53 | }(window)); 54 | -------------------------------------------------------------------------------- /examples/TimeFlies/TimeFlies.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Rx for JavaScript Rocks! 10 | 11 | 15 | 16 | 17 | 18 | 19 |
    20 |
    21 | 25 |
    26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /examples/TimeFlies/timeflies.css: -------------------------------------------------------------------------------- 1 | #container { 2 | font-family: Consolas monospace; 3 | overflow: hidden; 4 | } -------------------------------------------------------------------------------- /examples/TimeFlies/timeflies.js: -------------------------------------------------------------------------------- 1 | (function (window, undefined) { 2 | 3 | function getOffset(element) { 4 | var doc = element.ownerDocument, 5 | docElem = doc.documentElement, 6 | body = doc.body, 7 | clientTop = docElem.clientTop || body.clientTop || 0, 8 | clientLeft = docElem.clientLeft || body.clientLeft || 0, 9 | scrollTop = window.pageYOffset || body.scrollTop, 10 | scrollLeft = window.pageXOffset || body.scrollLeft; 11 | 12 | return { top : scrollTop - clientTop, left: scrollLeft - clientLeft }; 13 | } 14 | 15 | function initialize () { 16 | var i, 17 | text = 'time flies like an arrow', 18 | container = document.getElementById('textContainer'), 19 | mouseMove = Rx.DOM.mousemove(document), 20 | 21 | mouseMoveOffset = mouseMove.map(function(value) { 22 | var offset = getOffset(container); 23 | return { 24 | offsetX : value.clientX - offset.left + document.documentElement.scrollLeft, 25 | offsetY : value.clientY - offset.top + document.documentElement.scrollTop 26 | }; 27 | }); 28 | 29 | for (i = 0; i < text.length; i++) { 30 | (function(i) { 31 | var s = document.createElement('span'); 32 | s.innerHTML = text[i]; 33 | s.style.position = 'absolute'; 34 | container.appendChild(s); 35 | 36 | mouseMoveOffset.delay(i * 100).subscribe(function(mouseEvent) { 37 | s.style.top = mouseEvent.offsetY + 'px'; 38 | s.style.left = mouseEvent.offsetX + i * 10 + 15 + 'px'; 39 | }); 40 | })(i); 41 | } 42 | } 43 | 44 | Rx.DOM.ready().subscribe(initialize); 45 | }(window)) 46 | -------------------------------------------------------------------------------- /examples/dragndrop/dragndrop.css: -------------------------------------------------------------------------------- 1 | #dragTarget { 2 | background-image: url(logo.png); 3 | background-repeat: no-repeat; 4 | background-position: center; 5 | background-size: contain; 6 | height: 200px; 7 | width: 200px; 8 | background-color: #000000; 9 | border: 1px solid #666666; 10 | color: #ffffff; 11 | padding: 10px; 12 | position: absolute; 13 | cursor: move; 14 | } -------------------------------------------------------------------------------- /examples/dragndrop/dragndrop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Rx for JavaScript Rocks! 10 | 11 | 15 | 16 | 17 | 18 |
    Drag Me!
    19 |
    20 | 24 |
    25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /examples/dragndrop/dragndrop.js: -------------------------------------------------------------------------------- 1 | (function (window, undefined) { 2 | 3 | function initialize () { 4 | var dragTarget = document.getElementById('dragTarget'); 5 | 6 | // Get the three major events 7 | var mouseup = Rx.DOM.mouseup(dragTarget); 8 | var mousemove = Rx.DOM.mousemove(document); 9 | var mousedown = Rx.DOM.mousedown(dragTarget); 10 | 11 | var mousedrag = mousedown.flatMap(function (md) { 12 | 13 | // calculate offsets when mouse down 14 | var startX = md.offsetX, startY = md.offsetY; 15 | 16 | // Calculate delta with mousemove until mouseup 17 | return mousemove.map(function (mm) { 18 | mm.preventDefault(); 19 | 20 | return { 21 | left: mm.clientX - startX, 22 | top: mm.clientY - startY 23 | }; 24 | }).takeUntil(mouseup); 25 | }); 26 | 27 | // Update position 28 | subscription = mousedrag.subscribe(function (pos) { 29 | dragTarget.style.top = pos.top + 'px'; 30 | dragTarget.style.left = pos.left + 'px'; 31 | }); 32 | } 33 | 34 | Rx.DOM.ready().subscribe(initialize); 35 | 36 | }(window)); -------------------------------------------------------------------------------- /examples/dragndrop/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reactive-Extensions/RxJS-DOM/35271e7ddd7e68838d181beae3cee696b657f7f4/examples/dragndrop/logo.png -------------------------------------------------------------------------------- /examples/mutationobserver/mutationobserverscheduler.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Rx for JavaScript Rocks! 10 | 11 | 15 | 16 | 17 | 18 |
    19 |
    20 | 24 |
    25 |
      26 |
      27 |
      28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /examples/mutationobserver/mutationobserverscheduler.js: -------------------------------------------------------------------------------- 1 | (function (window, undefined) { 2 | 3 | function initialize() { 4 | var ul = document.getElementById('results'); 5 | 6 | Rx.Observable.range(1, 1000, Rx.Scheduler.microtask) 7 | .subscribe( 8 | function (results) { 9 | var li = document.createElement('li'); 10 | li.innerHTML = results; 11 | ul.appendChild(li); 12 | }); 13 | } 14 | 15 | Rx.DOM.ready().subscribe(initialize); 16 | 17 | }(window)); 18 | -------------------------------------------------------------------------------- /examples/vendor/bootstrap-3.2.0/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reactive-Extensions/RxJS-DOM/35271e7ddd7e68838d181beae3cee696b657f7f4/examples/vendor/bootstrap-3.2.0/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /examples/vendor/bootstrap-3.2.0/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reactive-Extensions/RxJS-DOM/35271e7ddd7e68838d181beae3cee696b657f7f4/examples/vendor/bootstrap-3.2.0/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /examples/vendor/bootstrap-3.2.0/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reactive-Extensions/RxJS-DOM/35271e7ddd7e68838d181beae3cee696b657f7f4/examples/vendor/bootstrap-3.2.0/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /examples/vendor/html5shiv-3.7.2/html5shiv.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document); -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var Rx = require('rx'); 2 | require('./dist/rx.dom'); 3 | module.exports = Rx; -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. 2 | Microsoft Open Technologies would like to thank its contributors, a list 3 | of whom are at http://rx.codeplex.com/wikipage?title=Contributors. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); you 6 | may not use this file except in compliance with the License. You may 7 | obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 14 | implied. See the License for the specific language governing permissions 15 | and limitations under the License. -------------------------------------------------------------------------------- /modules/lite-ajax-compat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom-ajax-compat", 3 | "title": "The Reactive Extensions Bindings for the DOM Ajax, Lite Compat Edition", 4 | "description": "Library for creating Ajax requests using RxJS for older browsers", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite-compat": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.ajax.compat.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.ajax.compat.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/lite-ajax-compat/readme.md: -------------------------------------------------------------------------------- 1 | # RxJS Lite DOM Ajax Compat Module # 2 | 3 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over the Ajax requests using RxJS Lite Compat for older browsers. 4 | 5 | ## Details ## 6 | 7 | Files: 8 | - [`rx.lite.dom.ajax.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/modules/lite-ajax-compat/rx.lite.dom.ajax.compat.js) 9 | 10 | NPM Packages: 11 | - [`rx-lite-dom-ajax-compat`](https://www.npmjs.com/package/rx-lite-dom-ajax-compat) 12 | 13 | ## API ## 14 | 15 | ### Ajax 16 | 17 | - [`Rx.DOM.ajax`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/ajax.md) 18 | - [`Rx.DOM.get`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/get.md) 19 | - [`Rx.DOM.getJSON`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/getjson.md) 20 | - [`Rx.DOM.post`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/post.md) 21 | - [`Rx.DOM.jsonpRequest`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/jsonprequest.md) 22 | -------------------------------------------------------------------------------- /modules/lite-ajax/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom-ajax", 3 | "title": "The Reactive Extensions Bindings for the DOM Ajax, Lite Edition", 4 | "description": "Library for creating Ajax requests using RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.ajax.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.ajax.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/lite-ajax/readme.md: -------------------------------------------------------------------------------- 1 | # RxJS Lite DOM Ajax Module # 2 | 3 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over the Ajax requests using RxJS Lite. 4 | 5 | ## Details ## 6 | 7 | Files: 8 | - [`rx.lite.dom.ajax.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/modules/lite-ajax/rx.lite.dom.ajax.js) 9 | 10 | NPM Packages: 11 | - [`rx-lite-dom-ajax`](https://www.npmjs.com/package/rx-lite-dom-ajax) 12 | 13 | ## API ## 14 | 15 | ### Ajax 16 | 17 | - [`Rx.DOM.ajax`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/ajax.md) 18 | - [`Rx.DOM.get`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/get.md) 19 | - [`Rx.DOM.getJSON`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/getjson.md) 20 | - [`Rx.DOM.post`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/post.md) 21 | - [`Rx.DOM.jsonpRequest`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/jsonprequest.md) 22 | -------------------------------------------------------------------------------- /modules/lite-compat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom-compat", 3 | "title": "The Reactive Extensions Bindings for the DOM Lite Compat Edition", 4 | "description": "Library for using DOM elements as well as Ajax requests using RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite-compat": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.compat.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.compat.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/lite-concurrency/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom-concurrency", 3 | "title": "The Reactive Extensions Bindings for the DOM Concurrency, Lite Compat Edition.", 4 | "description": "Library for with schedulers using the DOM with RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.concurrency.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.concurrency.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/lite-concurrency/readme.md: -------------------------------------------------------------------------------- 1 | # RxJS Lite DOM Concurrency Module # 2 | 3 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over the DOM scheduling using `requestAnimationFrame` and `MutationObserver` using RxJS Lite. 4 | 5 | ## Details ## 6 | 7 | Files: 8 | - [`rx.lite.dom.concurrency.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/modules/lite-concurrency/rx.lite.dom.concurrency.js) 9 | 10 | NPM Packages: 11 | - [`rx-lite-dom-concurrency`](https://www.npmjs.com/package/rx-lite-dom-concurrency) 12 | 13 | ## API ## 14 | 15 | ### Schedulers 16 | 17 | - [`Rx.Scheduler.requestAnimationFrame`](schedulers/requestanimationframe.md) 18 | - [`Rx.Scheduler.microtask`](schedulers/microtaskscheduler.md) 19 | -------------------------------------------------------------------------------- /modules/lite-events-compat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom-events-compat", 3 | "title": "The Reactive Extensions Bindings for the DOM Events, Lite Compat Edition.", 4 | "description": "Library for using DOM elements events with RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite-compat": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.events.compat.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.events.compat.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/lite-events/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom-events", 3 | "title": "The Reactive Extensions Bindings for the DOM Events, Lite Edition.", 4 | "description": "Library for using DOM elements events with RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.events.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.events.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/lite-html/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom-html", 3 | "title": "The Reactive Extensions Bindings for the HTML5 DOM, Lite Edition.", 4 | "description": "Library for using WebSockets, Workers, Geolocation, etc with RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.html.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.html.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/lite-html/readme.md: -------------------------------------------------------------------------------- 1 | # RxJS Lite DOM HTML5 Module # 2 | 3 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over Web Sockets, Web Workers, Server-Sent Events, Geolocation, MutationObservers and more using RxJS Lite. 4 | 5 | ## Details ## 6 | 7 | Files: 8 | - [`rx.lite.dom.html.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/modules/lite-html/rx.lite.dom.html.js) 9 | 10 | NPM Packages: 11 | - [`rx-lite-dom-html`](https://www.npmjs.com/package/rx-lite-dom-html) 12 | 13 | ## API ## 14 | 15 | #### Server-Sent Events 16 | - [`Rx.DOM.fromEventSource`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromeventsource.md) 17 | 18 | #### Web Sockets 19 | 20 | - [`Rx.DOM.fromWebSocket`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromwebsocket.md) 21 | 22 | #### Web Workers 23 | 24 | - [`Rx.DOM.fromWorker`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromworker.md) 25 | 26 | #### Mutation Observers 27 | 28 | - [`Rx.DOM.fromMutationObserver`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/frommutationobserver.md) 29 | 30 | #### Geolocation 31 | 32 | - [`Rx.DOM.geolocation.getCurrentPosition`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/getcurrentposition.md) 33 | - [`Rx.DOM.geolocation.watchPosition`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/watchposition.md) 34 | 35 | #### [`FileReader`](https://developer.mozilla.org/en-US/docs/Web/API/FileReader) 36 | 37 | - [`Rx.DOM.fromReader`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromreader.md) 38 | -------------------------------------------------------------------------------- /modules/lite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-lite-dom", 3 | "title": "The Reactive Extensions Bindings for the DOM Lite Edition.", 4 | "description": "Library for using DOM elements as well as Ajax requests using RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx-lite": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.lite.dom.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.lite.dom.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/main-ajax/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-dom-ajax", 3 | "title": "The Reactive Extensions Bindings for the DOM Ajax", 4 | "description": "Library creating Ajax requests with RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.dom.ajax.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.dom.ajax.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/main-ajax/readme.md: -------------------------------------------------------------------------------- 1 | # RxJS DOM Ajax Module # 2 | 3 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over the Ajax requests using RxJS. 4 | 5 | ## Details ## 6 | 7 | Files: 8 | - [`rx.dom.ajax.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/modules/main-ajax/rx.dom.ajax.js) 9 | 10 | NPM Packages: 11 | - [`rx-dom-ajax`](https://www.npmjs.com/package/rx-dom-ajax) 12 | 13 | ## API ## 14 | 15 | ### Ajax 16 | 17 | - [`Rx.DOM.ajax`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/ajax.md) 18 | - [`Rx.DOM.get`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/get.md) 19 | - [`Rx.DOM.getJSON`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/getjson.md) 20 | - [`Rx.DOM.post`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/post.md) 21 | - [`Rx.DOM.jsonpRequest`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/jsonprequest.md) 22 | -------------------------------------------------------------------------------- /modules/main-concurrency/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-dom-concurrency", 3 | "title": "The Reactive Extensions Bindings for the DOM Concurrency.", 4 | "description": "Library for using DOM methods to schedule work", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.dom.concurrency.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.dom.concurrency.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/main-concurrency/readme.md: -------------------------------------------------------------------------------- 1 | # RxJS DOM Concurrency Module # 2 | 3 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over the DOM scheduling using `requestAnimationFrame` and `MutationObserver` using RxJS. 4 | 5 | ## Details ## 6 | 7 | Files: 8 | - [`rx.dom.concurrency.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/modules/main-concurrency/rx.dom.concurrency.js) 9 | 10 | NPM Packages: 11 | - [`rx-dom-concurrency`](https://www.npmjs.com/package/rx-dom-concurrency) 12 | 13 | ## API ## 14 | 15 | ### Schedulers 16 | 17 | - [`Rx.Scheduler.requestAnimationFrame`](schedulers/requestanimationframe.md) 18 | - [`Rx.Scheduler.microtask`](schedulers/microtaskscheduler.md) 19 | -------------------------------------------------------------------------------- /modules/main-events/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-dom-events", 3 | "title": "The Reactive Extensions Bindings for DOM Events", 4 | "description": "Library to bind to DOM events using RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.dom.events.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.dom.events.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/main-events/rx.dom.events.min.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Microsoft, Inc. All rights reserved. See License.txt in the project root for license information.*/ 2 | (function(a){function b(a){return a&&a.Object===Object?a:null}var c={"function":!0,object:!0},d=c[typeof exports]&&exports&&!exports.nodeType?exports:null,e=c[typeof module]&&module&&!module.nodeType?module:null,f=b(d&&e&&"object"==typeof global&&global),g=b(c[typeof self]&&self),h=b(c[typeof window]&&window),i=(e&&e.exports===d?d:null,b(c[typeof this]&&this)),j=f||h!==(i&&i.window)&&h||g||i||Function("return this")();"function"==typeof define&&define.amd?define(["rx"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("rx")):j.Rx=a(j,{},j.Rx)}).call(this,function(a,b,c,d){function e(a){return function(){try{return a.apply(this,arguments)}catch(b){return o.e=b,o}}}function f(a){if(!m(a))throw new TypeError("fn must be a function");return e(a)}function g(a,b,c,d){this._e=a,this._n=b,this._fn=c,this._u=d,this._e.addEventListener(this._n,this._fn,this._u),this.isDisposed=!1}function h(a,b,c,d){if(a.addEventListener)return new g(a,b,c,d);throw new Error("No listener found")}function i(a,b,c,d){var e=new k,f=Object.prototype.toString;if("[object NodeList]"===f.call(a)||"[object HTMLCollection]"===f.call(a))for(var g=0,j=a.length;j>g;g++)e.add(i(a.item(g),b,c,d));else a&&e.add(h(a,b,c,d));return e}var j=c.ObservableBase,k=c.CompositeDisposable,l=c.DOM||(c.DOM={}),m=c.helpers.isFunction,n=c.internals.inherits,o={e:{}};g.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._e.removeEventListener(this._n,this._fn,this._u))};var p=function(a){function b(b,c,d,e){this._e=b,this._n=c,this._fn=d,this._uc=e,a.call(this)}function c(a,b){return function(){var c=arguments[0];return b&&(c=f(b).apply(null,arguments),c===o)?a.onError(c.e):void a.onNext(c)}}return n(b,a),b.prototype.subscribeCore=function(a){return i(this._e,this._n,c(a,this._fn),this._uc)},b}(j),q=l.fromEvent=function(a,b,c,d){var e=m(c)?c:null;return"boolean"==typeof c&&(d=c),"undefined"==typeof d&&(d=!1),new p(a,b,e,d).publish().refCount()};!function(){var b="blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu input";a.PointerEvent&&(b+=" pointerdown pointerup pointermove pointerover pointerout pointerenter pointerleave"),a.TouchEvent&&(b+=" touchstart touchend touchmove touchcancel"),b=b.split(" ");for(var c=0,d=b.length;d>c;c++)!function(a){l[a]=function(b,c,d){return q(b,a,c,d)}}(b[c])}();var r=function(b){function c(){b.call(this)}function d(a){return function(){a.onNext(),a.onCompleted()}}function e(b,c){this._o=b,this._fn=c,this._addedHandlers=!1,this.isDisposed=!1,"complete"===a.document.readyState?setTimeout(this._fn,0):(this._addedHandlers=!0,a.document.addEventListener("DOMContentLoaded",this._fn,!1))}return n(c,b),c.prototype.subscribeCore=function(a){return new e(a,d(a))},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,a.document.removeEventListener("DOMContentLoaded",this._fn,!1))},c}(j);return l.ready=function(){return new r},c}); 3 | //# sourceMappingURL=rx.dom.events.map -------------------------------------------------------------------------------- /modules/main-html/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-dom-html", 3 | "title": "The Reactive Extensions Bindings for the HTML5 DOM.", 4 | "description": "Library for using WebSockets, Workers, Geolocation, etc with RxJS", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx": "*" 18 | }, 19 | "jam": { 20 | "main": "rx.dom.html.js" 21 | }, 22 | "keywords": [ 23 | "Reactive", 24 | "FRP", 25 | "Rx", 26 | "RxJS", 27 | "DOM", 28 | "Ajax", 29 | "JSONP", 30 | "HTML5", 31 | "requestAnimationFrame", 32 | "WebSockets", 33 | "WebWorkers", 34 | "Geolocation" 35 | ], 36 | "main": "rx.dom.html.js" 37 | } 38 | -------------------------------------------------------------------------------- /modules/main-html/readme.md: -------------------------------------------------------------------------------- 1 | # RxJS DOM HTMl5 Module # 2 | 3 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over Web Sockets, Web Workers, Server-Sent Events, Geolocation, MutationObservers and more using RxJS. 4 | 5 | ## Details ## 6 | 7 | Files: 8 | - [`rx.dom.html.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/modules/main-html/rx.dom.html.js) 9 | 10 | NPM Packages: 11 | - [`rx-dom-html`](https://www.npmjs.com/package/rx-dom-html) 12 | 13 | ## API ## 14 | 15 | #### Server-Sent Events 16 | - [`Rx.DOM.fromEventSource`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromeventsource.md) 17 | 18 | #### Web Sockets 19 | 20 | - [`Rx.DOM.fromWebSocket`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromwebsocket.md) 21 | 22 | #### Web Workers 23 | 24 | - [`Rx.DOM.fromWorker`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromworker.md) 25 | 26 | #### Mutation Observers 27 | 28 | - [`Rx.DOM.fromMutationObserver`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/frommutationobserver.md) 29 | 30 | #### Geolocation 31 | 32 | - [`Rx.DOM.geolocation.getCurrentPosition`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/getcurrentposition.md) 33 | - [`Rx.DOM.geolocation.watchPosition`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/watchposition.md) 34 | 35 | #### [`FileReader`](https://developer.mozilla.org/en-US/docs/Web/API/FileReader) 36 | 37 | - [`Rx.DOM.fromReader`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/fromreader.md) 38 | -------------------------------------------------------------------------------- /modules/publish.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var fs = require('fs'); 3 | var execSync = require('child_process').execSync; 4 | 5 | var files = fs.readdirSync(process.cwd()); 6 | for (var i = 0; i < files.length; i++) { 7 | var file = files[i]; 8 | var stat = fs.statSync(file); 9 | if (stat.isDirectory()) { 10 | console.log('publishing %s', file); 11 | try { 12 | execSync('npm publish ' + file); 13 | } catch (e) { 14 | console.log('error in publishing %s: %s', file, e); 15 | } 16 | 17 | console.log('published %s', file); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /modules/version.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var fs = require('fs'); 3 | var execSync = require('child_process').execSync; 4 | 5 | var files = fs.readdirSync(process.cwd()); 6 | for (var i = 0; i < files.length; i++) { 7 | var file = files[i]; 8 | var stat = fs.statSync(file); 9 | if (stat.isDirectory()) { 10 | console.log('versioning %s', file); 11 | execSync('cd '+ file + ' && npm version '+ process.argv[2] + ' && cd ..'); 12 | console.log('versioned %s', file); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /nuget/RxJS-Bridges-HTML/RxJS-Bridges-HTML.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RxJS-Bridges-HTML 5 | Reactive Extensions for JavaScript - Bridges to the HTML DOM 6 | 7 | 2.0.8 8 | Microsoft Corporation 9 | This project provides Reactive Extensions for JavaScript (RxJS) bindings for HTML DOM objects to abstract over the event binding and Ajax requests. 10 | https://github.com/Reactive-Extensions/RxJS-DOM 11 | http://go.microsoft.com/fwlink/?LinkId=261274 12 | true 13 | http://www.apache.org/licenses/LICENSE-2.0.html 14 | en-US 15 | Rx RxJS Reactive Extensions Observable HTML5 HTML Ajax WebSockets WebWorkers 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rx-dom", 3 | "title": "The Reactive Extensions Bindings for the DOM.", 4 | "description": "Library for using DOM elements as well as Ajax requests", 5 | "version": "7.0.3", 6 | "homepage": "https://github.com/Reactive-Extensions/RxJS-DOM", 7 | "author": { 8 | "name": "Microsoft", 9 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/authors.txt" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Reactive-Extensions/RxJS-DOM.git" 14 | }, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "rx": "*" 18 | }, 19 | "devDependencies": { 20 | "grunt-cli": "*", 21 | "grunt": "*", 22 | "grunt-contrib-copy": "*", 23 | "grunt-contrib-jshint": "*", 24 | "grunt-contrib-connect": "*", 25 | "grunt-contrib-uglify": "*", 26 | "grunt-contrib-concat": "*", 27 | "grunt-contrib-qunit": "*", 28 | "grunt-contrib-watch": "*", 29 | "grunt-jscs": "*", 30 | "load-grunt-tasks":"*" 31 | }, 32 | "jam": { 33 | "main": "dist/rx.dom.js" 34 | }, 35 | "keywords": [ 36 | "Reactive", 37 | "FRP", 38 | "Rx", 39 | "RxJS", 40 | "DOM", 41 | "Ajax", 42 | "JSONP", 43 | "HTML5", 44 | "requestAnimationFrame", 45 | "WebSockets", 46 | "WebWorkers", 47 | "Geolocation" 48 | ], 49 | "main": "index.js", 50 | "scripts": { 51 | "test": "grunt" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/concurrency/requestanimationframescheduler.js: -------------------------------------------------------------------------------- 1 | var requestAnimFrame, cancelAnimFrame; 2 | if (root.requestAnimationFrame) { 3 | requestAnimFrame = root.requestAnimationFrame; 4 | cancelAnimFrame = root.cancelAnimationFrame; 5 | } else if (root.mozRequestAnimationFrame) { 6 | requestAnimFrame = root.mozRequestAnimationFrame; 7 | cancelAnimFrame = root.mozCancelAnimationFrame; 8 | } else if (root.webkitRequestAnimationFrame) { 9 | requestAnimFrame = root.webkitRequestAnimationFrame; 10 | cancelAnimFrame = root.webkitCancelAnimationFrame; 11 | } else if (root.msRequestAnimationFrame) { 12 | requestAnimFrame = root.msRequestAnimationFrame; 13 | cancelAnimFrame = root.msCancelAnimationFrame; 14 | } else if (root.oRequestAnimationFrame) { 15 | requestAnimFrame = root.oRequestAnimationFrame; 16 | cancelAnimFrame = root.oCancelAnimationFrame; 17 | } else { 18 | requestAnimFrame = function(cb) { root.setTimeout(cb, 1000 / 60); }; 19 | cancelAnimFrame = root.clearTimeout; 20 | } 21 | 22 | /** 23 | * Gets a scheduler that schedules schedules work on the requestAnimationFrame for immediate actions. 24 | */ 25 | Scheduler.requestAnimationFrame = (function () { 26 | var RequestAnimationFrameScheduler = (function (__super__) { 27 | inherits(RequestAnimationFrameScheduler, __super__); 28 | function RequestAnimationFrameScheduler() { 29 | __super__.call(this); 30 | } 31 | 32 | function scheduleAction(disposable, action, scheduler, state) { 33 | return function schedule() { 34 | !disposable.isDisposed && disposable.setDisposable(Disposable._fixup(action(scheduler, state))); 35 | }; 36 | } 37 | 38 | function ClearDisposable(method, id) { 39 | this._id = id; 40 | this._method = method; 41 | this.isDisposed = false; 42 | } 43 | 44 | ClearDisposable.prototype.dispose = function () { 45 | if (!this.isDisposed) { 46 | this.isDisposed = true; 47 | this._method.call(null, this._id); 48 | } 49 | }; 50 | 51 | RequestAnimationFrameScheduler.prototype.schedule = function (state, action) { 52 | var disposable = new SingleAssignmentDisposable(), 53 | id = requestAnimFrame(scheduleAction(disposable, action, this, state)); 54 | return new BinaryDisposable(disposable, new ClearDisposable(cancelAnimFrame, id)); 55 | }; 56 | 57 | RequestAnimationFrameScheduler.prototype._scheduleFuture = function (state, dueTime, action) { 58 | if (dueTime === 0) { return this.schedule(state, action); } 59 | var disposable = new SingleAssignmentDisposable(), 60 | id = root.setTimeout(scheduleAction(disposable, action, this, state), dueTime); 61 | return new BinaryDisposable(disposable, new ClearDisposable(root.clearTimeout, id)); 62 | }; 63 | 64 | return RequestAnimationFrameScheduler; 65 | }(Scheduler)); 66 | 67 | return new RequestAnimationFrameScheduler(); 68 | }()); 69 | -------------------------------------------------------------------------------- /src/dom/eventsource.js: -------------------------------------------------------------------------------- 1 | var EventSourceObservable = (function(__super__) { 2 | inherits(EventSourceObservable, __super__); 3 | function EventSourceObservable(url, open) { 4 | this._url = url; 5 | this._open = open; 6 | __super__.call(this); 7 | } 8 | 9 | function createOnOpen(o, source) { 10 | return function onOpen(e) { 11 | o.onNext(e); 12 | o.onCompleted(); 13 | source.removeEventListener('open', onOpen, false); 14 | }; 15 | } 16 | 17 | function createOnError(o) { 18 | return function onError(e) { 19 | if (e.readyState === EventSource.CLOSED) { 20 | o.onCompleted(); 21 | } else { 22 | o.onError(e); 23 | } 24 | }; 25 | } 26 | 27 | function createOnMessage(o) { return function onMessage(e) { o.onNext(e.data); }; } 28 | 29 | function EventSourceDisposable(s, errFn, msgFn) { 30 | this._s = s; 31 | this._errFn = errFn; 32 | this._msgFn = msgFn; 33 | this.isDisposed = false; 34 | } 35 | 36 | EventSourceDisposable.prototype.dispose = function () { 37 | if (!this.isDisposed) { 38 | this._s.removeEventListener('error', this._errFn, false); 39 | this._s.removeEventListener('message', this._msgFn, false); 40 | this._s.close(); 41 | } 42 | }; 43 | 44 | EventSourceObservable.prototype.subscribeCore = function (o) { 45 | var source = new EventSource(this._url); 46 | var onOpen = createOnOpen(this._open, source); 47 | var onError = createOnError(o); 48 | var onMessage = createOnMessage(o); 49 | 50 | this._open && source.addEventListener('open', onOpen, false); 51 | source.addEventListener('error', onError, false); 52 | source.addEventListener('message', onMessage, false); 53 | 54 | return new EventSourceDisposable(source, onError, onMessage); 55 | }; 56 | 57 | return EventSourceObservable; 58 | }(ObservableBase)); 59 | 60 | /** 61 | * This method wraps an EventSource as an observable sequence. 62 | * @param {String} url The url of the server-side script. 63 | * @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event. 64 | * @returns {Observable} An observable sequence which represents the data from a server-side event. 65 | */ 66 | dom.fromEventSource = function (url, openObserver) { 67 | if (!root.EventSource) { throw new TypeError('EventSource not implemented in your runtime.'); } 68 | return new EventSourceObservable(url, openObserver); 69 | }; 70 | -------------------------------------------------------------------------------- /src/dom/mutationobserver.js: -------------------------------------------------------------------------------- 1 | function getMutationObserver(next) { 2 | var M = root.MutationObserver || root.WebKitMutationObserver; 3 | return new M(next); 4 | } 5 | 6 | var MutationObserverObservable = (function (__super__) { 7 | inherits(MutationObserverObservable, __super__); 8 | function MutationObserverObservable(target, options) { 9 | this._target = target; 10 | this._options = options; 11 | __super__.call(this); 12 | } 13 | 14 | function InnerDisposable(mutationObserver) { 15 | this._m = mutationObserver; 16 | this.isDisposed = false; 17 | } 18 | 19 | InnerDisposable.prototype.dispose = function () { 20 | if (!this.isDisposed) { 21 | this.isDisposed = true; 22 | this._m.disconnect(); 23 | } 24 | }; 25 | 26 | MutationObserverObservable.prototype.subscribeCore = function (o) { 27 | var mutationObserver = getMutationObserver(function (e) { o.onNext(e); }); 28 | mutationObserver.observe(this._target, this._options); 29 | return new InnerDisposable(mutationObserver); 30 | }; 31 | 32 | return MutationObserverObservable; 33 | }(ObservableBase)); 34 | 35 | /** 36 | * Creates an observable sequence from a Mutation Observer. 37 | * MutationObserver provides developers a way to react to changes in a DOM. 38 | * @example 39 | * Rx.DOM.fromMutationObserver(document.getElementById('foo'), { attributes: true, childList: true, characterData: true }); 40 | * 41 | * @param {Object} target The Node on which to obserave DOM mutations. 42 | * @param {Object} options A MutationObserverInit object, specifies which DOM mutations should be reported. 43 | * @returns {Observable} An observable sequence which contains mutations on the given DOM target. 44 | */ 45 | dom.fromMutationObserver = function (target, options) { 46 | if (!(root.MutationObserver || root.WebKitMutationObserver)) { throw new TypeError('MutationObserver not implemented in your runtime.'); } 47 | return new MutationObserverObservable(target, options); 48 | }; 49 | -------------------------------------------------------------------------------- /src/dom/worker.js: -------------------------------------------------------------------------------- 1 | var WorkerObserver = (function (__super__) { 2 | inherits(WorkerObserver, __super__); 3 | function WorkerObserver(state) { 4 | this._state = state; 5 | __super__.call(this); 6 | } 7 | 8 | WorkerObserver.prototype.next = function (x) { this._state.worker && this._state.worker.postMessage(x); }; 9 | WorkerObserver.prototype.error = function (e) { throw e; }; 10 | WorkerObserver.prototype.completed = function () { }; 11 | 12 | return WorkerObserver; 13 | }(AbstractObserver)); 14 | 15 | var WorkerObservable = (function (__super__) { 16 | inherits(WorkerObservable, __super__); 17 | function WorkerObservable(state, url) { 18 | this._state = state; 19 | this._url = url; 20 | __super__.call(this); 21 | } 22 | 23 | function createMessageHandler(o) { return function messageHandler (e) { o.onNext(e); }; } 24 | function createErrHandler(o) { return function errHandler(e) { o.onError(e); }; } 25 | 26 | function WorkerDisposable(w, msgFn, errFn) { 27 | this._w = w; 28 | this._msgFn = msgFn; 29 | this._errFn = errFn; 30 | this.isDisposed = false; 31 | } 32 | 33 | WorkerDisposable.prototype.dispose = function () { 34 | if (!this.isDisposed) { 35 | this.isDisposed = true; 36 | this._w.terminate(); 37 | this._w.removeEventListener('message', this._msgFn, false); 38 | this._w.removeEventListener('error', this._errFn, false); 39 | } 40 | }; 41 | 42 | WorkerObservable.prototype.subscribeCore = function (o) { 43 | this._state.worker = new root.Worker(this._url); 44 | 45 | var messageHandler = createMessageHandler(o); 46 | var errHandler = createErrHandler(o); 47 | 48 | this._state.worker.addEventListener('message', messageHandler, false); 49 | this._state.worker.addEventListener('error', errHandler, false); 50 | 51 | return new WorkerDisposable(this._state.worker, messageHandler, errHandler); 52 | }; 53 | 54 | return WorkerObservable; 55 | }(ObservableBase)); 56 | 57 | /** 58 | * Creates a Web Worker with a given URL as a Subject. 59 | * 60 | * @example 61 | * var worker = Rx.DOM.fromWebWorker('worker.js'); 62 | * 63 | * @param {String} url The URL of the Web Worker. 64 | * @returns {Subject} A Subject wrapping the Web Worker. 65 | */ 66 | dom.fromWorker = function (url) { 67 | if (!root.Worker) { throw new TypeError('Worker not implemented in your runtime.'); } 68 | var state = { worker: null }; 69 | return Subject.create(new WorkerObserver(state), new WorkerObservable(state, url)); 70 | }; 71 | -------------------------------------------------------------------------------- /src/events/events.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | var events = 'blur focus focusin focusout load resize scroll unload click dblclick ' + 3 | 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave ' + 4 | 'change select submit keydown keypress keyup error contextmenu input'; 5 | 6 | if (root.PointerEvent) { 7 | events += ' pointerdown pointerup pointermove pointerover pointerout pointerenter pointerleave'; 8 | } 9 | 10 | if (root.TouchEvent) { 11 | events += ' touchstart touchend touchmove touchcancel'; 12 | } 13 | 14 | events = events.split(' '); 15 | 16 | for(var i = 0, len = events.length; i < len; i++) { 17 | (function (e) { 18 | dom[e] = function (element, selector, useCapture) { 19 | return fromEvent(element, e, selector, useCapture); 20 | }; 21 | }(events[i])) 22 | } 23 | }()); 24 | -------------------------------------------------------------------------------- /src/events/ready.js: -------------------------------------------------------------------------------- 1 | var ReadyObservable = (function (__super__) { 2 | inherits(ReadyObservable, __super__); 3 | function ReadyObservable() { 4 | __super__.call(this); 5 | } 6 | 7 | function createHandler(o) { 8 | return function handler() { 9 | o.onNext(); 10 | o.onCompleted(); 11 | }; 12 | } 13 | 14 | ReadyObservable.prototype.subscribeCore = function (o) { 15 | return new ReadyDisposable(o, createHandler(o)); 16 | }; 17 | 18 | function ReadyDisposable(o, fn) { 19 | this._o = o; 20 | this._fn = fn; 21 | this._addedHandlers = false; 22 | this.isDisposed = false; 23 | 24 | if (root.document.readyState === 'complete') { 25 | setTimeout(this._fn, 0); 26 | } else { 27 | this._addedHandlers = true; 28 | root.document.addEventListener( 'DOMContentLoaded', this._fn, false ); 29 | } 30 | } 31 | 32 | ReadyDisposable.prototype.dispose = function () { 33 | if (!this.isDisposed) { 34 | this.isDisposed = true; 35 | root.document.removeEventListener( 'DOMContentLoaded', this._fn, false ); 36 | } 37 | }; 38 | 39 | return ReadyObservable; 40 | }(ObservableBase)); 41 | 42 | /** 43 | * Creates an observable sequence when the DOM is loaded 44 | * @returns {Observable} An observable sequence fired when the DOM is loaded 45 | */ 46 | dom.ready = function () { 47 | return new ReadyObservable(); 48 | }; 49 | -------------------------------------------------------------------------------- /src/headers/header.ajax.js: -------------------------------------------------------------------------------- 1 | var Observable = Rx.Observable, 2 | ObservableBase = Rx.ObservableBase, 3 | dom = Rx.DOM || (Rx.DOM = {}), 4 | hasOwnProperty = {}.hasOwnProperty, 5 | inherits = Rx.internals.inherits; 6 | -------------------------------------------------------------------------------- /src/headers/header.concurrency.js: -------------------------------------------------------------------------------- 1 | var Disposable = Rx.Disposable, 2 | BinaryDisposable = Rx.BinaryDisposable, 3 | SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, 4 | Scheduler = Rx.Scheduler, 5 | inherits = Rx.internals.inherits; 6 | -------------------------------------------------------------------------------- /src/headers/header.events.js: -------------------------------------------------------------------------------- 1 | var ObservableBase = Rx.ObservableBase, 2 | CompositeDisposable = Rx.CompositeDisposable, 3 | dom = Rx.DOM || (Rx.DOM = {}), 4 | isFunction = Rx.helpers.isFunction, 5 | inherits = Rx.internals.inherits; 6 | -------------------------------------------------------------------------------- /src/headers/header.html.js: -------------------------------------------------------------------------------- 1 | var Observable = Rx.Observable, 2 | ObservableBase = Rx.ObservableBase, 3 | AbstractObserver = Rx.internals.AbstractObserver, 4 | observerCreate = Rx.Observer.create, 5 | observableCreate = Rx.Observable.create, 6 | disposableCreate = Rx.Disposable.create, 7 | Disposable = Rx.Disposable, 8 | CompositeDisposable = Rx.CompositeDisposable, 9 | BinaryDisposable = Rx.BinaryDisposable, 10 | SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, 11 | Subject = Rx.Subject, 12 | Scheduler = Rx.Scheduler, 13 | dom = Rx.DOM = {}, 14 | hasOwnProperty = {}.hasOwnProperty, 15 | noop = Rx.helpers.noop, 16 | isFunction = Rx.helpers.isFunction, 17 | inherits = Rx.internals.inherits; 18 | -------------------------------------------------------------------------------- /src/headers/header.js: -------------------------------------------------------------------------------- 1 | var Observable = Rx.Observable, 2 | ObservableBase = Rx.ObservableBase, 3 | AbstractObserver = Rx.internals.AbstractObserver, 4 | observerCreate = Rx.Observer.create, 5 | observableCreate = Rx.Observable.create, 6 | disposableCreate = Rx.Disposable.create, 7 | Disposable = Rx.Disposable, 8 | CompositeDisposable = Rx.CompositeDisposable, 9 | BinaryDisposable = Rx.BinaryDisposable, 10 | SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, 11 | Subject = Rx.Subject, 12 | Scheduler = Rx.Scheduler, 13 | dom = Rx.DOM = {}, 14 | hasOwnProperty = {}.hasOwnProperty, 15 | noop = Rx.helpers.noop, 16 | isFunction = Rx.helpers.isFunction, 17 | inherits = Rx.internals.inherits; 18 | -------------------------------------------------------------------------------- /src/headers/intro.compat.js: -------------------------------------------------------------------------------- 1 | ;(function (factory) { 2 | var objectTypes = { 3 | 'function': true, 4 | 'object': true 5 | }; 6 | 7 | function checkGlobal(value) { 8 | return (value && value.Object === Object) ? value : null; 9 | } 10 | 11 | var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; 12 | var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; 13 | var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global); 14 | var freeSelf = checkGlobal(objectTypes[typeof self] && self); 15 | var freeWindow = checkGlobal(objectTypes[typeof window] && window); 16 | var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; 17 | var thisGlobal = checkGlobal(objectTypes[typeof this] && this); 18 | var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); 19 | 20 | // Because of build optimizers 21 | if (typeof define === 'function' && define.amd) { 22 | define(['rx-compat'], function (Rx, exports) { 23 | return factory(root, exports, Rx); 24 | }); 25 | } else if (typeof module === 'object' && module && module.exports === freeExports) { 26 | module.exports = factory(root, module.exports, require('rx-compat')); 27 | } else { 28 | root.Rx = factory(root, {}, root.Rx); 29 | } 30 | }.call(this, function (root, exp, Rx, undefined) { 31 | -------------------------------------------------------------------------------- /src/headers/intro.js: -------------------------------------------------------------------------------- 1 | ;(function (factory) { 2 | var objectTypes = { 3 | 'function': true, 4 | 'object': true 5 | }; 6 | 7 | function checkGlobal(value) { 8 | return (value && value.Object === Object) ? value : null; 9 | } 10 | 11 | var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; 12 | var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; 13 | var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global); 14 | var freeSelf = checkGlobal(objectTypes[typeof self] && self); 15 | var freeWindow = checkGlobal(objectTypes[typeof window] && window); 16 | var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; 17 | var thisGlobal = checkGlobal(objectTypes[typeof this] && this); 18 | var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); 19 | 20 | // Because of build optimizers 21 | if (typeof define === 'function' && define.amd) { 22 | define(['rx'], function (Rx, exports) { 23 | return factory(root, exports, Rx); 24 | }); 25 | } else if (typeof module === 'object' && module && module.exports === freeExports) { 26 | module.exports = factory(root, module.exports, require('rx')); 27 | } else { 28 | root.Rx = factory(root, {}, root.Rx); 29 | } 30 | }.call(this, function (root, exp, Rx, undefined) { 31 | -------------------------------------------------------------------------------- /src/headers/intro.lite.compat.js: -------------------------------------------------------------------------------- 1 | ;(function (factory) { 2 | var objectTypes = { 3 | 'function': true, 4 | 'object': true 5 | }; 6 | 7 | function checkGlobal(value) { 8 | return (value && value.Object === Object) ? value : null; 9 | } 10 | 11 | var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; 12 | var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; 13 | var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global); 14 | var freeSelf = checkGlobal(objectTypes[typeof self] && self); 15 | var freeWindow = checkGlobal(objectTypes[typeof window] && window); 16 | var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; 17 | var thisGlobal = checkGlobal(objectTypes[typeof this] && this); 18 | var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); 19 | 20 | // Because of build optimizers 21 | if (typeof define === 'function' && define.amd) { 22 | define(['rx-lite-compat'], function (Rx, exports) { 23 | return factory(root, exports, Rx); 24 | }); 25 | } else if (typeof module === 'object' && module && module.exports === freeExports) { 26 | module.exports = factory(root, module.exports, require('rx-lite-compat')); 27 | } else { 28 | root.Rx = factory(root, {}, root.Rx); 29 | } 30 | }.call(this, function (root, exp, Rx, undefined) { 31 | -------------------------------------------------------------------------------- /src/headers/intro.lite.js: -------------------------------------------------------------------------------- 1 | ;(function (factory) { 2 | var objectTypes = { 3 | 'function': true, 4 | 'object': true 5 | }; 6 | 7 | function checkGlobal(value) { 8 | return (value && value.Object === Object) ? value : null; 9 | } 10 | 11 | var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; 12 | var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; 13 | var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global); 14 | var freeSelf = checkGlobal(objectTypes[typeof self] && self); 15 | var freeWindow = checkGlobal(objectTypes[typeof window] && window); 16 | var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; 17 | var thisGlobal = checkGlobal(objectTypes[typeof this] && this); 18 | var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); 19 | 20 | // Because of build optimizers 21 | if (typeof define === 'function' && define.amd) { 22 | define(['rx-lite'], function (Rx, exports) { 23 | return factory(root, exports, Rx); 24 | }); 25 | } else if (typeof module === 'object' && module && module.exports === freeExports) { 26 | module.exports = factory(root, module.exports, require('rx-lite')); 27 | } else { 28 | root.Rx = factory(root, {}, root.Rx); 29 | } 30 | }.call(this, function (root, exp, Rx, undefined) { 31 | -------------------------------------------------------------------------------- /src/headers/license.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft, Inc. All rights reserved. See License.txt in the project root for license information. 2 | -------------------------------------------------------------------------------- /src/headers/outro.js: -------------------------------------------------------------------------------- 1 | return Rx; 2 | })); -------------------------------------------------------------------------------- /src/internal/trycatch.js: -------------------------------------------------------------------------------- 1 | var errorObj = {e: {}}; 2 | 3 | function tryCatcherGen(tryCatchTarget) { 4 | return function tryCatcher() { 5 | try { 6 | return tryCatchTarget.apply(this, arguments); 7 | } catch (e) { 8 | errorObj.e = e; 9 | return errorObj; 10 | } 11 | }; 12 | } 13 | 14 | function tryCatch(fn) { 15 | if (!isFunction(fn)) { throw new TypeError('fn must be a function'); } 16 | return tryCatcherGen(fn); 17 | } 18 | 19 | function thrower(e) { 20 | throw e; 21 | } 22 | -------------------------------------------------------------------------------- /tests/ajax/tests.jsonp.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | /* jshint undef: true, unused: true */ 4 | /* globals QUnit, asyncTest, Rx, equal, ok */ 5 | QUnit.module('JSONP Tests'); 6 | 7 | asyncTest('jsonpRequest with jsonp callback success', function () { 8 | 9 | var fakeScript = "data:text/javascript;base64," + btoa( 10 | 'testCallback([{ "id": 123 }])' 11 | ); 12 | 13 | var source = Rx.DOM.jsonpRequest({ 14 | url: fakeScript, 15 | jsonpCallback: 'testCallback' 16 | }); 17 | 18 | source.subscribe( 19 | function (x) { 20 | equal(123, x.response[0].id); 21 | }, 22 | function () { 23 | ok(false); 24 | }, 25 | function () { 26 | ok(true); 27 | QUnit.start(); 28 | } 29 | ); 30 | }); 31 | 32 | asyncTest('jsonpRequest without jsonp callback success', function () { 33 | var fakeScript = "data:text/javascript;base64," + btoa( 34 | 'testCallback([{ "id": 123 }])' 35 | ); 36 | 37 | var source = Rx.DOM.jsonpRequest({ 38 | url: fakeScript, 39 | jsonpCallback: 'testCallback' 40 | }); 41 | 42 | source.subscribe( 43 | function (x) { 44 | equal(123, x.response[0].id); 45 | }, 46 | function () { 47 | ok(false); 48 | }, 49 | function () { 50 | ok(true); 51 | QUnit.start(); 52 | } 53 | ); 54 | }); 55 | 56 | asyncTest('jsonpRequest without jsonp callback success with 2 observers', function () { 57 | var fakeScript = "data:text/javascript;base64," + btoa( 58 | 'testCallback([{ "id": 123 }])' 59 | ); 60 | 61 | var source = Rx.DOM.jsonpRequest({ 62 | url: fakeScript, 63 | jsonpCallback: 'testCallback' 64 | }); 65 | 66 | source.subscribe( 67 | function (x) { 68 | equal(123, x.response[0].id); 69 | }, 70 | function () { 71 | ok(false); 72 | }, 73 | function () { 74 | ok(true); 75 | QUnit.start(); 76 | } 77 | ); 78 | 79 | var source2 = Rx.DOM.jsonpRequest({ 80 | url: fakeScript, 81 | jsonpCallback: 'testCallback' 82 | }); 83 | 84 | source2.subscribe( 85 | function (x) { 86 | equal(123, x.response[0].id); 87 | }, 88 | function () { 89 | ok(false); 90 | }, 91 | function () { 92 | ok(true); 93 | QUnit.start(); 94 | } 95 | ); 96 | }); 97 | 98 | }()); 99 | -------------------------------------------------------------------------------- /tests/concurrency/tests.microtaskscheduler.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | /* jshint undef: true, unused: true */ 4 | /* globals QUnit, test, asyncTest, Rx, ok, start */ 5 | QUnit.module('MicrotaskScheduler'); 6 | 7 | test('MicrotaskScheduler now', function () { 8 | var res = Rx.Scheduler.microtask.now() - new Date().getTime(); 9 | ok(res < 1000); 10 | }); 11 | 12 | asyncTest('MicrotaskScheduler schedule', function () { 13 | Rx.Scheduler.microtask.schedule(null, function () { 14 | ok(true); 15 | start(); 16 | }); 17 | }); 18 | 19 | asyncTest('MicrotaskScheduler schedule future relative', function () { 20 | Rx.Scheduler.microtask.scheduleFuture(new Date().getTime(), 200, function (s, startTime) { 21 | var endTime = new Date().getTime(); 22 | ok(endTime - startTime > 180, endTime - startTime); 23 | start(); 24 | }); 25 | }); 26 | 27 | asyncTest('MicrotaskScheduler schedule future absolute', function () { 28 | Rx.Scheduler.microtask.scheduleFuture(new Date().getTime(), new Date(Date.now() + 200), function (s, startTime) { 29 | var endTime = new Date().getTime(); 30 | ok(endTime - startTime > 180, endTime - startTime); 31 | start(); 32 | }); 33 | }); 34 | 35 | asyncTest('MicrotaskScheduler schedule action and cancel', function () { 36 | var set = false; 37 | var d = Rx.Scheduler.microtask.scheduleFuture(null, 200, function () { 38 | set = true; 39 | }); 40 | 41 | d.dispose(); 42 | 43 | setTimeout(function () { 44 | ok(!set); 45 | start(); 46 | }, 400); 47 | }); 48 | }()); 49 | -------------------------------------------------------------------------------- /tests/concurrency/tests.requestanimationframescheduler.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | /* jshint undef: true, unused: true */ 4 | /* globals QUnit, test, asyncTest, Rx, ok, start */ 5 | QUnit.module('RequestAnimationFrameScheduler'); 6 | 7 | test('RequestAnimationFrameScheduler now', function () { 8 | var res = Rx.Scheduler.requestAnimationFrame.now() - new Date().getTime(); 9 | ok(res < 1000); 10 | }); 11 | 12 | asyncTest('RequestAnimationFrameScheduler schedule', function () { 13 | Rx.Scheduler.requestAnimationFrame.schedule(null, function () { 14 | ok(true); 15 | start(); 16 | }); 17 | }); 18 | 19 | asyncTest('RequestAnimationFrameScheduler schedule future relative', function () { 20 | Rx.Scheduler.requestAnimationFrame.scheduleFuture(new Date().getTime(), 200, function (s, startTime) { 21 | var endTime = new Date().getTime(); 22 | ok(endTime - startTime > 180, endTime - startTime); 23 | start(); 24 | }); 25 | }); 26 | 27 | asyncTest('RequestAnimationFrameScheduler schedule future absolute', function () { 28 | Rx.Scheduler.requestAnimationFrame.scheduleFuture(new Date().getTime(), new Date(Date.now() + 200), function (s, startTime) { 29 | var endTime = new Date().getTime(); 30 | ok(endTime - startTime > 180, endTime - startTime); 31 | start(); 32 | }); 33 | }); 34 | 35 | asyncTest('RequestAnimationFrameScheduler schedule action and cancel', function () { 36 | var set = false; 37 | var d = Rx.Scheduler.requestAnimationFrame.scheduleFuture(null, 200, function () { 38 | set = true; 39 | }); 40 | 41 | d.dispose(); 42 | 43 | setTimeout(function () { 44 | ok(!set); 45 | start(); 46 | }, 400); 47 | }); 48 | }()); 49 | -------------------------------------------------------------------------------- /tests/dom/tests.mutationobserver.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | /* jshint undef: true, unused: true */ 4 | /* globals QUnit, test, equal, Rx, window */ 5 | var original, mutationObserver; 6 | 7 | function MockMutationObserver(next) { 8 | this._next = next; 9 | this._connected = false; 10 | mutationObserver = this; 11 | } 12 | 13 | MockMutationObserver.prototype.observe = function (target, options) { 14 | this._target = target; 15 | this._options = options; 16 | this._connected = true; 17 | }; 18 | 19 | MockMutationObserver.prototype.disconnect = function () { 20 | this._connected = false; 21 | }; 22 | 23 | MockMutationObserver.prototype.trigger = function (data) { 24 | this._next(data); 25 | }; 26 | 27 | QUnit.module('Websocket', { 28 | beforeEach: function(){ 29 | // mock WebSocket 30 | original = window.MutationObserver; 31 | }, 32 | 33 | afterEach: function(){ 34 | window.MutationObserver = original; 35 | } 36 | }); 37 | 38 | var DOM = Rx.DOM, 39 | Observer = Rx.Observer, 40 | TestScheduler = Rx.TestScheduler, 41 | onNext = Rx.ReactiveTest.onNext; 42 | 43 | test('MutationObserver not created until subscribe', function () { 44 | window.MutationObserver = MockMutationObserver; 45 | 46 | var source = Rx.DOM.fromMutationObserver('foo', 'bar'); 47 | 48 | equal(mutationObserver, undefined); 49 | 50 | var d = source.subscribe(Observer.create()); 51 | 52 | equal(mutationObserver._target, 'foo'); 53 | equal(mutationObserver._options, 'bar'); 54 | equal(mutationObserver._connected, true); 55 | 56 | d.dispose(); 57 | 58 | equal(mutationObserver._connected, false); 59 | }); 60 | 61 | test('MutationObserver fires values on change', function () { 62 | window.MutationObserver = MockMutationObserver; 63 | 64 | var scheduler = new TestScheduler(); 65 | 66 | var source, subscription; 67 | var results = scheduler.createObserver(); 68 | 69 | scheduler.scheduleAbsolute(null, 100, function () { source = DOM.fromMutationObserver('foo'); }); 70 | scheduler.scheduleAbsolute(null, 200, function () { subscription = source.subscribe(results); }); 71 | scheduler.scheduleAbsolute(null, 1000, function () { subscription.dispose(); }); 72 | 73 | scheduler.scheduleAbsolute(null, 300, function () { mutationObserver.trigger(1); }); 74 | scheduler.scheduleAbsolute(null, 400, function () { mutationObserver.trigger(2); }); 75 | scheduler.scheduleAbsolute(null, 500, function () { mutationObserver.trigger(3); }); 76 | 77 | scheduler.start(); 78 | 79 | results.messages.assertEqual( 80 | onNext(300, 1), 81 | onNext(400, 2), 82 | onNext(500, 3) 83 | ); 84 | }); 85 | }()); 86 | -------------------------------------------------------------------------------- /tests/helpers/btoa.js: -------------------------------------------------------------------------------- 1 | // From https://github.com/davidchambers/Base64.js 2 | ;(function () { 3 | 4 | var object = typeof exports != 'undefined' ? exports : this; // #8: web workers 5 | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 6 | 7 | function InvalidCharacterError(message) { 8 | this.message = message; 9 | } 10 | InvalidCharacterError.prototype = new Error; 11 | InvalidCharacterError.prototype.name = 'InvalidCharacterError'; 12 | 13 | // encoder 14 | // [https://gist.github.com/999166] by [https://github.com/nignag] 15 | object.btoa || ( 16 | object.btoa = function (input) { 17 | var str = String(input); 18 | for ( 19 | // initialize result and counter 20 | var block, charCode, idx = 0, map = chars, output = ''; 21 | // if the next str index does not exist: 22 | // change the mapping table to "=" 23 | // check if d has no fractional digits 24 | str.charAt(idx | 0) || (map = '=', idx % 1); 25 | // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 26 | output += map.charAt(63 & block >> 8 - idx % 1 * 8) 27 | ) { 28 | charCode = str.charCodeAt(idx += 3/4); 29 | if (charCode > 0xFF) { 30 | throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); 31 | } 32 | block = block << 8 | charCode; 33 | } 34 | return output; 35 | }); 36 | 37 | // decoder 38 | // [https://gist.github.com/1020396] by [https://github.com/atk] 39 | object.atob || ( 40 | object.atob = function (input) { 41 | var str = String(input).replace(/=+$/, ''); 42 | if (str.length % 4 == 1) { 43 | throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded."); 44 | } 45 | for ( 46 | // initialize result and counters 47 | var bc = 0, bs, buffer, idx = 0, output = ''; 48 | // get next character 49 | buffer = str.charAt(idx++); 50 | // character found in table? initialize bit storage and add its ascii value; 51 | ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, 52 | // and if not first of each 4 characters, 53 | // convert the first 8 bits to one ascii character 54 | bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 55 | ) { 56 | // try to find character in table (0-63, not found => -1) 57 | buffer = chars.indexOf(buffer); 58 | } 59 | return output; 60 | }); 61 | 62 | }()); 63 | -------------------------------------------------------------------------------- /tests/helpers/reactiveassert.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict' 3 | 4 | var slice = Array.prototype.slice; 5 | 6 | function createMessage(actual, expected) { 7 | return 'Expected: [' + expected.toString() + ']\r\nActual: [' + actual.toString() + ']'; 8 | } 9 | 10 | Array.prototype.assertEqual = function () { 11 | var expected = slice.call(arguments); 12 | var actual = this; 13 | 14 | var i, isOk = true; 15 | if (expected.length !== actual.length) { 16 | ok(false, 'Not equal length. Expected: ' + expected.length + ' Actual: ' + actual.length); 17 | return; 18 | } 19 | for (i = 0; i < expected.length; i++) { 20 | var e = expected[i], a = actual[i]; 21 | // ALlow for predicates 22 | if (e.value && typeof e.value.predicate === 'function') { 23 | 24 | isOk = e.time === a.time && e.value.predicate(a.value); 25 | } else { 26 | isOk = Rx.internals.isEqual(e, a); 27 | } 28 | 29 | if (!isOk) { 30 | break; 31 | } 32 | } 33 | ok(isOk, createMessage(actual, expected)); 34 | }; 35 | }()); 36 | -------------------------------------------------------------------------------- /tests/rx.dom.compat.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Reactive Extensions for JavaScript Tests for DOM 7 | 8 | 9 | 10 |
      11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | --------------------------------------------------------------------------------