Skip to content

Instantly share code, notes, and snippets.

@davidchase
Created April 18, 2016 19:30
Show Gist options
  • Save davidchase/f9a4f3202bbd3b6dceacfe4c14e8e61d to your computer and use it in GitHub Desktop.
Save davidchase/f9a4f3202bbd3b6dceacfe4c14e8e61d to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
import most from 'most'
const patchy = new Promise((res, rej) => rej('PATCH ERR'))
const posty = new Promise((res, rej) => res('POST RESULT'))
most.fromPromise(patchy)
.recoverWith(function(err){
return most.fromPromise(posty);
})
.observe(console.info.bind(console))
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"most": "0.18.8",
"babel-runtime": "6.6.1"
}
}
'use strict';
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _most = require('most');
var _most2 = _interopRequireDefault(_most);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var patchy = new _promise2.default(function (res, rej) {
return rej('PATCH ERR');
});
var posty = new _promise2.default(function (res, rej) {
return res('POST RESULT');
});
_most2.default.fromPromise(patchy).recoverWith(function (err) {
return _most2.default.fromPromise(posty);
}).observe(console.info.bind(console));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment