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

Commit c2e91eb

Browse files
Adding docs
1 parent 9907352 commit c2e91eb

File tree

5 files changed

+116
-39
lines changed

5 files changed

+116
-39
lines changed

doc/operators/ajax.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
`Rx.DOM.ajax(url | settings)`
2+
[Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax.js "View in source")
3+
4+
Creates a hot observable for an Ajax request with either a settings object with url, headers, etc or a string for a URL.
5+
6+
#### Arguments
7+
- `url` *(String)*: A string of the URL to make the Ajax call.
8+
- `settings` *(Object)*: An object with the following properties
9+
10+
- `url` *(String)*: URL of the request
11+
- `method` *(String)*: Method of the request, such as GET, POST, PUT, PATCH, DELETE
12+
- `async` *(Boolean)*: Whether the request is async
13+
- `headers` *(Object)*: Optional headers
14+
15+
#### Returns
16+
*(Observable)*: An observable sequence containing the `XMLHttpRequest`.
17+
18+
#### Example
19+
20+
The following example uses a simple URL to retrieve a list of products.
21+
```js
22+
Rx.DOM.Request.ajax('/products')
23+
.subscribe(
24+
function (xhr) {
25+
26+
var products = JSON.parse(xhr.responseText);
27+
28+
products.forEach(function (product) {
29+
console.log(product);
30+
});
31+
},
32+
function (error) {
33+
// Log the error
34+
}
35+
);
36+
```
37+
38+
### Location
39+
40+
File:
41+
- [`/src/ajax.md`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/ajax.js)
42+
43+
Dist:
44+
- [`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)
45+
46+
Prerequisites:
47+
- If using `rx.js`
48+
- [`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)
49+
- [`rx.binding.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.binding.js)
50+
- [`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)
51+
52+
NPM Packages:
53+
- [`rx-dom`](https://preview.npmjs.com/package/rx-dom)
54+
55+
NuGet Packages:
56+
- [`RxJS-Bridges-HTML`](http://www.nuget.org/packages/RxJS-Bridges-HTML/)
57+
58+
Unit Tests:
59+
- None

doc/operators/fromevent.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
### `Rx.DOM.fromEvent(element, eventName, [selector])`
2+
[Ⓢ](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/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+
11+
#### Returns
12+
*(`Observable`)*: An observable sequence of events from the specified element and the specified event.
13+
14+
#### Example
15+
16+
```js
17+
var input = document.querySelectorAll('table tr td');
18+
19+
var source = Rx.Observable.fromEvent(input, 'click');
20+
21+
var subscription = source.subscribe(
22+
function (x) {
23+
console.log('Next: 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/fromevent.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/fromevent.js)
37+
- [`/src/fromevent.compat.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/src/fromevent.compat.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/fromevent.js`](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/tests/fromevent.js)

doc/readme.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -88,43 +88,7 @@ Schedulers
8888

8989
* * *
9090

91-
### <a id="#rxdomrequestajaxurl--settings"></a>`Rx.DOM.Request.ajax(url | settings)`
92-
<a href="#rxdomrequestajaxurl--settings">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/rx.dom.js#L227-L229 "View in source") [&#x24C9;][1]
9391

94-
Creates a hot observable for an Ajax request with either a settings object with url, headers, etc or a string for a URL.
95-
96-
#### Arguments
97-
1. `url` *(String)*: A string of the URL to make the Ajax call.
98-
1. `settings` *(Object)*: An object with the following properties
99-
100-
- `url` *(String)*: URL of the request
101-
- `method` *(String)*: Method of the request, such as GET, POST, PUT, PATCH, DELETE
102-
- `async` *(Boolean)*: Whether the request is async
103-
- `headers` *(Object)*: Optional headers
104-
105-
#### Returns
106-
*(Observable)*: An observable sequence containing the `XMLHttpRequest`.
107-
108-
#### Example
109-
110-
The following example uses a simple URL to retrieve a list of products.
111-
```js
112-
Rx.DOM.Request.ajax('/products')
113-
.subscribe(
114-
function (xhr) {
115-
116-
var products = JSON.parse(xhr.responseText);
117-
118-
products.forEach(function (product) {
119-
console.log(product);
120-
});
121-
},
122-
function (error) {
123-
// Log the error
124-
}
125-
);
126-
```
127-
* * *
12892

12993
### <a id="rxdomrequestajaxcoldurl--settings"></a>`Rx.DOM.Request.ajaxCold(url | settings)`
13094
<a href="#rxdomrequestajaxcoldurl--settings">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/rx.dom.js#L145-L204 "View in source") [&#x24C9;][1]

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
}
2020
],
2121
"dependencies": {
22-
"rx": "*",
23-
"jsdom": "*"
22+
"rx": "*"
2423
},
2524
"devDependencies": {
2625
"grunt-cli": "*",

src/geolocation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if ('navigator' in root && 'geolocation' in root.navigator) {
2-
Rx.DOM.Geolocation = {
2+
Rx.DOM.geolocation = {
33

44
/**
55
* Obtains the geographic position, in terms of latitude and longitude coordinates, of the device.

0 commit comments

Comments
 (0)