Configurable encoding. #126

This commit is contained in:
Michael Teeuw
2016-04-05 13:16:23 +02:00
parent 1a20bd2f4d
commit 06efd01032
5 changed files with 24 additions and 8 deletions

View File

@@ -20,7 +20,7 @@ module.exports = NodeHelper.create({
// Subclass socketNotificationReceived received.
socketNotificationReceived: function(notification, payload) {
if(notification === 'ADD_FEED') {
this.createFetcher(payload.url, payload.reloadInterval);
this.createFetcher(payload.url, payload.reloadInterval, payload.encoding);
}
},
@@ -32,7 +32,7 @@ module.exports = NodeHelper.create({
* attribute reloadInterval number - Reload interval in milliseconds.
*/
createFetcher: function(url, reloadInterval) {
createFetcher: function(url, reloadInterval, encoding) {
var self = this;
if (!validUrl.isUri(url)){
@@ -43,7 +43,7 @@ module.exports = NodeHelper.create({
var fetcher;
if (typeof self.fetchers[url] === 'undefined') {
console.log('Create new news fetcher for url: ' + url + ' - Interval: ' + reloadInterval);
fetcher = new Fetcher(url, reloadInterval);
fetcher = new Fetcher(url, reloadInterval, encoding);
fetcher.onReceive(function(fetcher) {
self.sendSocketNotification('NEWS_ITEMS', {