<script src="https://cdnjs.cloudflare.com/ajax/libs/co/4.1.0/index.min.js"></script>
<script>
function test() {
return new Promise(function (success, error) {
if(1 > 0) {
success(true);
}else{
error(false);
}
});
}
co(function* (){
var check;
check = yield test();
alert(check);
}).catch(e => alert(e))
</script>