Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Commit

Permalink
Blip ♪
Browse files Browse the repository at this point in the history
  • Loading branch information
ahultgren committed Apr 15, 2015
1 parent 45b6434 commit 1446189
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"babel": "^5.1.9",
"bluebird": "^2.9.24",
"dotenv": "^1.1.0",
"howler": "^1.1.25",
"nconf": "^0.7.1",
"pg": "^4.3.0",
"ws": "^0.7.1"
Expand Down
Binary file added public/sounds/blip.wav
Binary file not shown.
11 changes: 11 additions & 0 deletions source/js/blips.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

var howler = require('howler');

var blip = new howler.Howl({
urls: ['../sounds/blip.wav']
});

exports.blip = () => {
blip.play();
};
4 changes: 3 additions & 1 deletion source/js/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
'use strict';

var socket = new WebSocket('ws://localhost:8080');
var thematrix = require('./thematrix');
var blips = require('./blips');
var socket = new WebSocket('ws://localhost:8080');
var allowedMessages = ['LoadArticle', 'pageview', 'articleseen'];

socket.onmessage = (e) => {
var data = e.data.split('|');

if(allowedMessages.indexOf(data[0]) > -1) {
thematrix.draw(data);
blips.blip();
}
};

Expand Down

0 comments on commit 1446189

Please sign in to comment.