阅读背景:

使用Callback加载数据。使用ES6 Promises有更好的解决方案吗?

来源:互联网 

I have a method that is called in several places in the project. I've done method. the first method call do Ajax get, cache data in class property and fire callback. Second call method only call callback with cached data. I would like to add the ability to load data synchronously. Date should be returned by the method. I added an additional parameter to call {async: false}, but I wonder if there is a better solution using ES7 promises?I have a method that is called in several place




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: