Use the diff
code highlighting tag.
```diff
- foo
+ bar
Example:
h('div.container', [ | |
h('label.nameLabel', 'Name:'), | |
h('input.myinput', {attributes: {type: 'text'}}), | |
h('hr'), | |
h('h1.greeting', `Hello ${name}`) | |
]) | |
// or | |
div('.container', [ |
function main() { | |
return { | |
DOM: Rx.Observable.timer(0, 1000) | |
.map(i => `Seconds elapsed ${i}`) | |
}; | |
} | |
const drivers = { | |
DOM: function DOMDriver(sink) { | |
sink.subscribe(text => { |
function main() { | |
return { | |
DOM: Rx.Observable.timer(0, 1000) | |
.map(i => { | |
return { | |
tagName: 'h1', | |
children: [`Seconds elapsed ${i}`] | |
} | |
}) | |
} |
Rx.Observable.timer(0, 1000) | |
.map(i => `Seconds elapsed ${i}`) | |
.subscribe(text => { | |
const container = document.querySelector('#app'); | |
container.textContent = text; | |
}); |
{run} = require '@cycle/core' | |
{Observable} = require 'rx' | |
{div, input, h2, makeDOMDriver} = require '@cycle/dom' | |
intent = (domSource) => | |
changeWeight$ = domSource | |
.select('#weight').events('input') | |
.map((ev) => ev.target.value) | |
changeHeight$ = domSource | |
.select('#height').events('input') |
import {Observable, Disposable} from 'rx'; | |
import {run} from '@cycle/core' | |
const jsondiffpatch = require('jsondiffpatch').create({ | |
objectHash: function(obj) { | |
return obj.name; | |
} | |
}); | |
function generateCurve(steps){ | |
var curve = new Float32Array(steps) |
var operators = [ | |
'\\.case', | |
'\\.create', | |
'\\.defer', | |
'\\.empty', | |
'\\.forkJoin', | |
'\\.from', | |
'\\.fromCallback', | |
'\\.fromEvent', | |
'\\.fromEventPattern', |
Run this in one shell
./node_modules/.bin/mocha --debug-brk --compilers js:babel-register test/node
Then this in another shell
node-inspector
Then open the browser
// Generic helper function that takes a main() (the top-level component) | |
// and wraps it with Stanga logic | |
function wrapWithStanga(main, initialState) { | |
return function (sources) { | |
const modProxy$ = new Subject(); | |
const modelSource = Model(initialState)(modProxy$); | |
sources.model = modelSource; | |
const sinks = main(sources); | |
sinks.model.subscribe(modProxy$); |