Created
November 18, 2014 21:04
-
-
Save kpuputti/99c7eadf925ffc37815b to your computer and use it in GitHub Desktop.
Testing Flow.
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
/* @flow */ | |
function wait(time: number): Promise<string> { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve.bind(null, 'resolved in ' + time + 'ms'), time); | |
}); | |
} | |
document.addEventListener('DOMContentLoaded', () => { | |
console.log('start'); | |
wait(1000).then((s) => { | |
console.log('got message:', s); | |
}, () => { | |
console.error('error'); | |
}); | |
console.log('stop'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment