-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26bfbce
commit fec05c3
Showing
5 changed files
with
55 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var tadaa = require('../lib/tadaa'); | ||
|
||
var audioPlayer = 'aplay' // player used to play sounds, defaults to aplay | ||
var interval = 10000; // time in ms for which the value function is called | ||
var up = 'up.wav'; // sound to play when value goes up | ||
var down = 'down.wav'; // sound to play when value goes down | ||
|
||
var fnup = function(currentValue, newValue) { | ||
return newValue > currentValue; | ||
}; | ||
|
||
var fndown = function(currentValue, newValue) { | ||
return newValue < currentValue; | ||
}; | ||
|
||
// Function to call to get the value | ||
var getValue = function(options, callback){ | ||
// ...insert your clever value logic... | ||
var number = Math.random() * 100; | ||
console.log(number); | ||
callback(null, number); | ||
} | ||
|
||
// Data to pass to the function. | ||
var getValueOptions = { a : 1, b : 2 }; | ||
|
||
tadaa.start( | ||
interval, | ||
[{fn: fnup, sound:up}, {fn: fndown, sound:down}], | ||
getValue, | ||
getValueOptions, | ||
audioPlayer); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters