Skip to content

Commit

Permalink
Added beep when QR scanned.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sem committed Apr 9, 2014
1 parent 30ff0a8 commit 9d11927
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/util/ng/modals.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(function() {
define(['util/ng/sound'], function(SoundUtils) {
var $modal;
var ModalUtils = {

Expand Down Expand Up @@ -60,6 +60,7 @@ var ModalUtils = {
},

onQrModalOk: function(data, vars) {
SoundUtils.play('keygenEnd');
if (Array.isArray(vars.field)) {
vars.field.push({address: data});
} else {
Expand Down
16 changes: 16 additions & 0 deletions js/util/ng/sound.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
define(function() {
var SoundUtils = {

play: function(sound) {
var audio = document.createElement('audio');
audio.setAttribute('autoplay', 'autoplay');
audio.innerHTML = '<source src="../sound/' + sound + '.opus" type="audio/ogg" />';
document.getElementById('fixed').appendChild(audio);
},

registerScope: function(scope) {
scope.playSound = SoundUtils.play;
}
};
return SoundUtils;
});
Binary file added sound/keygenEnd.opus
Binary file not shown.
3 changes: 3 additions & 0 deletions test/unit/util/ng/soundSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define(['util/ng/modals'], function(ModalUtils) {
'use strict';
});

0 comments on commit 9d11927

Please sign in to comment.