如何使用 SpotifyWebAPI 的 setPromiseImplementation 方法
How to use setPromiseImplementation method from SpotifyWebAPI
我想在浏览器 javascript(chrome 扩展)中使用库 SpotifyWebApi
(link)。
If you want to use a Promises/A+ library, you can set it
spotifyApi.setPromiseImplementation(Q);
如果我这样做,会引发错误
Uncaught ReferenceError: Q is not defined
如果这样
spotifyApi.setPromiseImplementation(Promise);
Error handling response: TypeError: _promiseImplementation.defer is
not a function
如何使用此库 Promise
?
How to use Promise
with this library?
如果您指的是原生全局 Promise
,那么什么都不做 - 它开箱即用。如果您想使用自定义承诺库,您只需要 setPromiseImplementation
。
How to use setPromiseImplementation
method?
我认为它的功能已损坏。它仅适用于 Q.js 或 Q-compatible API,即您传递的库函数需要同时支持 the promise constructor pattern and the deferred pattern。如果您计划使用 ES6-Promise drop-in 库并且不想替换本地全局 window.Promise
,我建议提交错误报告。
我想在浏览器 javascript(chrome 扩展)中使用库 SpotifyWebApi
(link)。
If you want to use a Promises/A+ library, you can set it
spotifyApi.setPromiseImplementation(Q);
如果我这样做,会引发错误
Uncaught ReferenceError: Q is not defined
如果这样
spotifyApi.setPromiseImplementation(Promise);
Error handling response: TypeError: _promiseImplementation.defer is not a function
如何使用此库 Promise
?
How to use
Promise
with this library?
如果您指的是原生全局 Promise
,那么什么都不做 - 它开箱即用。如果您想使用自定义承诺库,您只需要 setPromiseImplementation
。
How to use
setPromiseImplementation
method?
我认为它的功能已损坏。它仅适用于 Q.js 或 Q-compatible API,即您传递的库函数需要同时支持 the promise constructor pattern and the deferred pattern。如果您计划使用 ES6-Promise drop-in 库并且不想替换本地全局 window.Promise
,我建议提交错误报告。