forked from Outils-PeerTube/listener-rss-aggregator
		
	Added declaration and a begin of Readme
This commit is contained in:
		
							
								
								
									
										54
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
# Listener-rss-agregator
 | 
			
		||||
---
 | 
			
		||||
## Brief
 | 
			
		||||
This is an agregator of rss's listener (more information about it here : ).
 | 
			
		||||
## Usage
 | 
			
		||||
The basic usage is to use many listener-rss with a unique class.
 | 
			
		||||
```typescript
 | 
			
		||||
import { ManageListener } from 'Listener-rss-agregator';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const path = '/my/data/directorie/bd.sqlite'
 | 
			
		||||
const myManager = new ManageListener(path);
 | 
			
		||||
 | 
			
		||||
await ml.load(); // he is reading the database
 | 
			
		||||
 | 
			
		||||
const listenerConfig =
 | 
			
		||||
	{
 | 
			
		||||
    	"address": "fake.rss.service.1",
 | 
			
		||||
    	"timeloop": 10
 | 
			
		||||
  	};
 | 
			
		||||
 | 
			
		||||
ml.registerListener(listenerConfig);
 | 
			
		||||
 | 
			
		||||
ml.on('update', (obj) => {
 | 
			
		||||
	doSomethingWithNewEntries(obj);
 | 
			
		||||
	ml.save();
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
ml.startAll();
 | 
			
		||||
 | 
			
		||||
//...
 | 
			
		||||
 | 
			
		||||
ml.stopAll();
 | 
			
		||||
ml.save();
 | 
			
		||||
``` 
 | 
			
		||||
## Documentation
 | 
			
		||||
### Why SQLITE
 | 
			
		||||
This project use SQLITE to store the listener-rss configs and keep an correct historic of this. Sqlite was choice for her difficulty to access and read it. The database dont need to be modify by the user.
 | 
			
		||||
### Constructor
 | 
			
		||||
The constructor need to have a file to store the sqlite data. If the file does not exist he will be create, but the path must be valid.
 | 
			
		||||
### Function
 | 
			
		||||
#### `load()`
 | 
			
		||||
An async method who would read the sqlite file and create the corresponding objects
 | 
			
		||||
#### `save()`
 | 
			
		||||
An method who would store the actual configuration and erase the older
 | 
			
		||||
#### `registerListener(listenerConfig)`
 | 
			
		||||
He's create an new listener-rss with the corresponding config data. (More information about the listenerConfig here : )
 | 
			
		||||
#### `startAll()`
 | 
			
		||||
Start all the listener who are actually register
 | 
			
		||||
#### `stopAll()`
 | 
			
		||||
Start all the listener who are actually register
 | 
			
		||||
### Events
 | 
			
		||||
Like listener-rss, listener-rss-agregator implement EventEmitter.  
 | 
			
		||||
The event who's used is named `update`. He's called for each new entries detection per listener. he's giving back an object who contains all the new entries
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "listener-rss-agregator",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "version": "0.0.2",
 | 
			
		||||
  "description": "",
 | 
			
		||||
  "main": "build/index.js",
 | 
			
		||||
  "types": "build/index.d.ts",
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,9 @@
 | 
			
		||||
    "esModuleInterop": true,
 | 
			
		||||
    "resolveJsonModule": false,
 | 
			
		||||
    "skipLibCheck": true,
 | 
			
		||||
    "forceConsistentCasingInFileNames": true
 | 
			
		||||
    "forceConsistentCasingInFileNames": true,
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
    "declarationMap": true
 | 
			
		||||
  },
 | 
			
		||||
  "exclude": [
 | 
			
		||||
    "build/",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user