我想使用Promise,但是我有一个类似以下格式的回调API:
1. DOM加载或其他一次事件:
window.onload; // set to callback
...
window.onload = function() {
};
2.普通回调:
function request(onChangeHandler) {
    ...
}
request(function() {
    // change happened
    ...
});
3.节点样式回调(“ nodeback”):
function getStuff(dat, callback) {
    ...
}
getStuff("dataParam", function(err, data) {
    ...
})
4.带有节点样式回调的整个库:
API;
API.one(function(err, data) {
    API.two(function(err, data2) {
        API.three(function(err, data3) {
            ...
        });
    });
});


大概晚了5年,但我想在这里发布我的promesify版本,该版本采用回调API的功能并将其转化为承诺
在这里看看这个非常简单的版本:https : //gist.github.com/jdtorregrosas/aeee96dd07558a5d18db1ff02f31e21a