made with esnextbin
Last active
March 8, 2016 20:27
-
-
Save TylorS/cc30f6b0513a4c2f74ee 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 --> | |
<div id='app'></div> | |
</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
const Cycle = require('@cycle/core') | |
const {h, div, makeDOMDriver} = require('cycle-snabbdom') | |
const Rx = require('rx') | |
const main = function(sources){ | |
return { | |
DOM: Rx.Observable.just(1).map(() => | |
div('#app', {}, ['XXX']) | |
) | |
} | |
} | |
const container = document.getElementById('app') | |
setTimeout(() => { | |
console.log(container) | |
const patchedNode = document.getElementById('app') | |
console.log(container === patchedNode) | |
}, 1000) | |
Cycle.run(main, { | |
DOM: makeDOMDriver(container) | |
}) |
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": { | |
"@cycle/core": "6.0.3", | |
"cycle-snabbdom": "1.1.1", | |
"rx": "4.1.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 Cycle = require('@cycle/core'); | |
var _require = require('cycle-snabbdom'); | |
var h = _require.h; | |
var div = _require.div; | |
var makeDOMDriver = _require.makeDOMDriver; | |
var Rx = require('rx'); | |
var main = function main(sources) { | |
return { | |
DOM: Rx.Observable.just(1).map(function () { | |
return div('#app', {}, ['XXX']); | |
}) | |
}; | |
}; | |
var container = document.getElementById('app'); | |
setTimeout(function () { | |
console.log(container); | |
var patchedNode = document.getElementById('app'); | |
console.log(container === patchedNode); | |
}, 1000); | |
Cycle.run(main, { | |
DOM: makeDOMDriver(container) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment