官术网_书友最值得收藏!

Observables from promises (fromPromise)

You can also create EventStreams from ES6 promises or jQuery AJAX. These streams will contain only a single value (or an error in case of failure), and finish. We will need a promise to test this method:

var promiseObject = Promise.resolve(10); 

Here, we are creating a successful promise that will return the value 10. To transform this promise into an EventStream, we use the following code:

Bacon 
.fromPromise(promiseObject);
Keep in mind you will need Node.js version 4 or above, or a modern browser to test this code (old browsers don't have promises implemented).
主站蜘蛛池模板: 鄂托克旗| 建始县| 东兰县| 巢湖市| 彭泽县| 新干县| 德安县| 商南县| 永仁县| 古浪县| 贵南县| 登封市| 郎溪县| 阿鲁科尔沁旗| 株洲市| 平度市| 原平市| 天等县| 封丘县| 金塔县| 青浦区| 页游| 巴南区| 鞍山市| 贡觉县| 新巴尔虎右旗| 新邵县| 手机| 宁陵县| 贡山| 当涂县| 壤塘县| 达尔| 泽州县| 海兴县| 平湖市| 凤凰县| 大石桥市| 龙井市| 龙南县| 如皋市|