Skip to content

Commit c34d306

Browse files
author
Ed Ceaser
committed
Require node 4. back to es6. thank god
1 parent 5c52f25 commit c34d306

File tree

4 files changed

+45
-12
lines changed

4 files changed

+45
-12
lines changed

.eslintrc

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"rules": {
3+
"indent": [
4+
2,
5+
2
6+
],
7+
"quotes": [
8+
2,
9+
"single"
10+
],
11+
"linebreak-style": [
12+
2,
13+
"unix"
14+
],
15+
"semi": [
16+
2,
17+
"always"
18+
]
19+
},
20+
"env": {
21+
"es6": true,
22+
"node": true
23+
},
24+
"extends": "eslint:recommended"
25+
}

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ for other bundles to use.
77

88
## Dependencies
99

10-
Depends on [lfg-twitchapi](https://github.com/SupportClass/lfg-twitchapi).
10+
* NodeJS 4.x
11+
* NodeCG 0.6.x
12+
* [lfg-twitchapi](https://github.com/SupportClass/lfg-twitchapi)
1113

1214
## Installation
1315

extension.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ const POLL_INTERVAL = 30*1000;
55
function Followers(nodecg) {
66
this.nodecg = nodecg;
77
this.twitch = nodecg.extensions['lfg-twitchapi'];
8-
this.latestFollower = nodecg.Replicant("latestFollower", { defaultValue: null, persistent: true });
8+
this.latestFollower = nodecg.Replicant('latestFollower', { defaultValue: null, persistent: true });
99

1010
this._scheduleFollowers();
1111
}
1212

1313
Followers.prototype._scheduleFollowers = function() {
14-
this.nodecg.log.debug("Polling for TwitchTV Followers.");
14+
this.nodecg.log.debug('Polling for TwitchTV Followers.');
1515
this.twitch.get('/channels/{{username}}/follows', { limit: 50, direction: 'desc' },
16-
function (err, code, body) {
16+
(err, code, body) => {
1717
if (err) {
1818
this.nodecg.log.error(err);
19-
setTimeout(function() { this._scheduleFollowers() }.bind(this), POLL_INTERVAL);
19+
setTimeout(() => { this._scheduleFollowers(); }, POLL_INTERVAL);
2020
return;
2121
}
2222

2323
if (code != 200) {
24-
this.nodecg.log.error("Unknown response code: "+code);
25-
setTimeout(function() { this._scheduleFollowers() }.bind(this), POLL_INTERVAL);
24+
this.nodecg.log.error('Unknown response code: '+code);
25+
setTimeout(() => { this._scheduleFollowers(); }, POLL_INTERVAL);
2626
return;
2727
}
2828

@@ -32,19 +32,19 @@ Followers.prototype._scheduleFollowers = function() {
3232
}
3333

3434
if (body.follows.length > 0) {
35-
this.nodecg.log.debug("Discovered " + body.follows.length + " followers.");
35+
this.nodecg.log.debug('Discovered ' + body.follows.length + ' followers.');
3636
this.latestFollower.value = body.follows[0];
3737

38-
body.follows.reverse().map(function(follower) {
38+
body.follows.reverse().map((follower) => {
3939
var parsedTs = Date.parse(follower.created_at);
4040
if (parsedTs > lastFollowerTs) {
4141
this.nodecg.sendMessage('follower', follower);
4242
}
43-
}.bind(this));
43+
});
4444
}
4545

46-
setTimeout(function() { this._scheduleFollowers() }.bind(this), POLL_INTERVAL);
47-
}.bind(this)
46+
setTimeout(() => { this._scheduleFollowers(); }, POLL_INTERVAL);
47+
}
4848
);
4949
};
5050

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@
55
"description": "Tracks TwitchTV channel followers. Currently runs in the dashboard.",
66
"main": "extension.js",
77
"author": "Ed Ceaser <[email protected]>",
8+
"engines": {
9+
"node": ">=4.0.0"
10+
},
811
"license": "MIT",
912
"dependencies": {
1013
"node-localstorage": "^0.6.0"
14+
},
15+
"devDependencies": {
16+
"eslint": "^1.6.0"
1117
}
1218
}

0 commit comments

Comments
 (0)