Skip to content

Instantly share code, notes, and snippets.

@andreloureiro
Created December 2, 2016 12:50
Show Gist options
  • Save andreloureiro/ae29737cd815858f2431c6fa855f181a to your computer and use it in GitHub Desktop.
Save andreloureiro/ae29737cd815858f2431c6fa855f181a 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>
<div id="app"></div>
</body>
</html>
import xs from 'xstream';
import {div, makeDOMDriver} from '@cycle/dom';
import {run} from '@cycle/xstream-run';
import isolate from '@cycle/isolate';
const category = sources => {
return {
// DOM: xs.of('category')
DOM: xs.of(div('category'))
}
};
const Category = sources => isolate(category)(sources);
const main = ({ DOM }) => {
const category$ = Category({DOM});
return {
DOM: category$.DOM
}
};
run(main, {
DOM: makeDOMDriver('#app')
});
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"xstream": "9.0.0",
"@cycle/dom": "14.1.0",
"@cycle/xstream-run": "4.0.0",
"@cycle/isolate": "1.4.0"
}
}
'use strict';
var _xstream = require('xstream');
var _xstream2 = _interopRequireDefault(_xstream);
var _dom = require('@cycle/dom');
var _xstreamRun = require('@cycle/xstream-run');
var _isolate = require('@cycle/isolate');
var _isolate2 = _interopRequireDefault(_isolate);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var category = function category(sources) {
return {
// DOM: xs.of('category')
DOM: _xstream2.default.of((0, _dom.div)('category'))
};
};
var Category = function Category(sources) {
return (0, _isolate2.default)(category)(sources);
};
var main = function main(_ref) {
var DOM = _ref.DOM;
var category$ = Category({ DOM: DOM });
return {
DOM: category$.DOM
};
};
(0, _xstreamRun.run)(main, {
DOM: (0, _dom.makeDOMDriver)('#app')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment