Espruino/tests/test_signal_emitter.js
Michael Duerinckx 7f5308590b Rename numbered tests to something more descriptive - closes #16
test077 is the only one I really couldn't figure out what it was meant
to test.
2014-03-01 22:15:28 +00:00

16 lines
319 B
JavaScript

// Test Signal Emit
var val = 1;
var result = false;
function Lala() {
}
var foo = new Lala();
foo.on('up', function() { val+=99; });
foo.on('down', function(x) { val-=x; });
foo.emit('up');
foo.emit('down', 58);
// set result after a timeout - to allow the events time to execute
setTimeout("result = val==42;",1);