update Readme
This commit is contained in:
parent
df3f2a3049
commit
271f445aef
28
README.md
28
README.md
|
@ -56,11 +56,12 @@ listener.stop();
|
|||
An interface to structure listener's data.
|
||||
|
||||
### Constructor
|
||||
- name : the service name
|
||||
|
||||
- address : the service address
|
||||
- [optional] timeloop : time to wait between 2 request in seconds (default 5 minutes)
|
||||
- [optional] customfields : to notice field who's custom to the service (default blank)
|
||||
[cf annexe CustomFields](#customfields)
|
||||
- [optional] lastEntriesLinks : to specify an predefined history.
|
||||
|
||||
## ListenerRSS
|
||||
|
||||
|
@ -85,7 +86,7 @@ Reject the promise if the server can't be resolved.
|
|||
|
||||
### start()
|
||||
|
||||
This function will call the `update` event to each success update, the
|
||||
This function will call the `update` event to each success update, the
|
||||
`update_err` event to each fail update, and the `newEntries` event for
|
||||
each update who contains a new item.
|
||||
|
||||
|
@ -95,25 +96,30 @@ Each event take one arg into the callback function.
|
|||
|
||||
```js
|
||||
const callback_fun = (obj) => {
|
||||
// some act
|
||||
// some act
|
||||
};
|
||||
const callback_fun_err = (err) => {
|
||||
// some act
|
||||
// some act
|
||||
};
|
||||
const callback_fun_new_entries = (newEntries) => {
|
||||
// some act
|
||||
// some act
|
||||
};
|
||||
|
||||
listener.on("update", callback_fun);
|
||||
listener.on("update_err", callback_fun_err);
|
||||
listener.on("newEntries", callback_fun_new_entries);
|
||||
listener.on("new_entries", callback_fun_new_entries);
|
||||
```
|
||||
|
||||
#### update
|
||||
|
||||
It used a callback who receive the received object entirely inside an object.
|
||||
|
||||
#### update_err
|
||||
|
||||
It used a callback who receive an error object.
|
||||
#### newEntries
|
||||
|
||||
#### new_entries
|
||||
|
||||
It used a callback who receive only new entries inside an array.
|
||||
|
||||
### stop()
|
||||
|
@ -175,13 +181,9 @@ Here an example of what type of json object is output during a fetch :
|
|||
"content": "<a href=\"http://example.com\">this is a link</a> & <b>this is bold text</b>",
|
||||
"contentSnippet": "this is a link & this is bold text",
|
||||
"guid": "fake.rrs.service/item1",
|
||||
"categories": [
|
||||
"test",
|
||||
"npm",
|
||||
"fakeInfos",
|
||||
],
|
||||
"categories": ["test", "npm", "fakeInfos"],
|
||||
"isoDate": "2015-11-12T21:16:39.000Z"
|
||||
},
|
||||
}
|
||||
/*Some Others items*/
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user