made with esnextbin
Created
March 20, 2017 07:54
-
-
Save chenxeed/28388fa71c636843b7a90b40a0b23a69 to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
import xs from 'xstream'; | |
import rx from 'rx-lite'; | |
import $ from 'jquery'; | |
const request = $.ajax({url: 'https://jsonplaceholder.typicode.com/posts/1' }) | |
const xs$ = xs.fromPromise(request).addListener({next: resp => console.log('xs', resp) }); | |
const rx$ = rx.Observable.fromPromise(request).subscribe( resp => console.log('rx', resp) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"xstream": "9.3.0", | |
"rx-lite": "4.0.8", | |
"jquery": "3.2.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _xstream = require('xstream'); | |
var _xstream2 = _interopRequireDefault(_xstream); | |
var _rxLite = require('rx-lite'); | |
var _rxLite2 = _interopRequireDefault(_rxLite); | |
var _jquery = require('jquery'); | |
var _jquery2 = _interopRequireDefault(_jquery); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var request = _jquery2.default.ajax({ url: 'https://jsonplaceholder.typicode.com/posts/1' }); // write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
var xs$ = _xstream2.default.fromPromise(request).addListener({ next: function next(resp) { | |
return console.log('xs', resp); | |
} }); | |
var rx$ = _rxLite2.default.Observable.fromPromise(request).subscribe(function (resp) { | |
return console.log('rx', resp); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment