Skip to content

Instantly share code, notes, and snippets.

View rehia's full-sized avatar

Jérôme Avoustin rehia

View GitHub Profile
@rehia
rehia / foo
Last active August 29, 2015 14:11
How to test that something didn't happen in JavaScript other than with setTimeout ?
function Foo (emitter, expectedPerson) {
this.waitForSomething = function(callback) {
emitter.on('something_happened', function(person) {
if (expectedPerson === person) {
callback(person);
}
});
};
return this;
};