made with esnextbin
esnextbin sketch
This file contains 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> | |
<div id="app">Application</div> | |
</body> | |
</html> |
This file contains 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
import Cycle from '@cycle/most-run'; | |
import { | |
makeDOMDriver, | |
AttrsModule, | |
ClassModule, | |
StyleModule, | |
PropsModule, | |
VNode, | |
div, | |
} from '@motorcycle/dom'; | |
import { just, Stream } from 'most'; | |
const id = `#anId`; | |
const view = div(id, {}, [`Hello, world!`]); | |
const DOM = just(view); | |
console.log(DOM instanceof Stream); // true | |
function main() { | |
return { | |
DOM // Uncaught Error: The DOM driver function | |
// expects as input a Stream of virtual DOM elements | |
}; | |
} | |
const modules = | |
[ | |
AttrsModule, | |
ClassModule, | |
StyleModule, | |
PropsModule | |
]; | |
const drivers = { | |
DOM: makeDOMDriver(`#app`, { transposition: false, modules } ) | |
}; | |
Cycle.run(main, drivers); |
This file contains 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": { | |
"@cycle/most-run": "4.1.3", | |
"@motorcycle/dom": "3.0.0", | |
"most": "1.1.0" | |
} | |
} |
This file contains 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 _mostRun = require('@cycle/most-run'); | |
var _mostRun2 = _interopRequireDefault(_mostRun); | |
var _dom = require('@motorcycle/dom'); | |
var _most = require('most'); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var id = '#anId'; | |
var view = (0, _dom.div)(id, {}, ['Hello, world!']); | |
var DOM = (0, _most.just)(view); | |
console.log(DOM instanceof _most.Stream); // true | |
function main() { | |
return { | |
DOM: DOM // Uncaught Error: The DOM driver function | |
// expects as input a Stream of virtual DOM elements | |
}; | |
} | |
var modules = [_dom.AttrsModule, _dom.ClassModule, _dom.StyleModule, _dom.PropsModule]; | |
var drivers = { | |
DOM: (0, _dom.makeDOMDriver)('#app', { transposition: false, modules: modules }) | |
}; | |
_mostRun2.default.run(main, drivers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment