Wrapping imported construtor in a promise

人盡茶涼 提交于 2019-12-12 02:17:56

问题


I have the same problem as Promisify imported class (constructor) with bluebird in ES6 + babel. The accepted answer seems to have a bug but I couldnt comment on that thread (not enough reputation points), so am creating a new question. The bug seems to be in:

var o = new lib.C(); // get object
o.then(function(data){
    // access data
});

I get a run-time error:

~/node_modules/bluebird/js/main/promise.js:114
    return this._then(didFulfill, didReject, didProgress,
                ^ TypeError: undefined is not a function
    at C.Promise.then (~/node_modules/bluebird/js/main/promise.js:114:17)
    at Object.<anonymous> (~/temp/jsex.js:367:3)
    at Module._compile (module.js:460:26)

Can somebody post a working sample? Or point out if I'm missing something?

来源:https://stackoverflow.com/questions/37014920/wrapping-imported-construtor-in-a-promise

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!