Use the diff
code highlighting tag.
```diff
- foo
+ bar
Example:
function main() { | |
return { | |
DOM: Rx.Observable.timer(0, 1000) | |
.map(i => `Seconds elapsed ${i}`) | |
}; | |
} | |
const drivers = { | |
DOM: function DOMDriver(sink) { | |
sink.subscribe(text => { |
h('div.container', [ | |
h('label.nameLabel', 'Name:'), | |
h('input.myinput', {attributes: {type: 'text'}}), | |
h('hr'), | |
h('h1.greeting', `Hello ${name}`) | |
]) | |
// or | |
div('.container', [ |
let Rx = require(`rx`) | |
function makeRequestProxies(drivers) { | |
let requestProxies = {} | |
for (let name in drivers) { | |
if (drivers.hasOwnProperty(name)) { | |
requestProxies[name] = new Rx.ReplaySubject(1) | |
} | |
} | |
return requestProxies |
function runInScope(main, sources, context, ...args) { | |
if(!main) { | |
throw new Error('A "main" function must be supplied, which will be called in scope and from which a (sinks) object will be returned'); | |
} | |
if(!sources) { | |
throw new Error('A source drivers object must be supplied, to which scoping can be applied'); | |
} | |
if(!context) { | |
throw new Error('A scope context object must be supplied, either as a string, or as an object of key/value pairs'); | |
} |
define(function(require) { | |
var React = require('react'); | |
var paramRegex = /__(\d)+/; | |
var parser = new DOMParser(); | |
var errorDoc = parser.parseFromString('INVALID', 'text/xml'); | |
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI; | |
// turns the array of string parts into a DOM | |
// throws if the result is an invalid XML document. |
'use strict'; | |
import {Router5, RouteNode} from 'router5'; | |
import logger from '../logger'; | |
// The set of valid sink functions includes synchronous state-affecting router functions that do not require a callback | |
// and which do not have a significant return value other than the router object itself. | |
const validSinkFuncs = ['add','addNode','canActivate','deregisterComponent','navigate','registerComponent','setOption','start','stop']; | |
function validateAndRemapSinkArgument(arg) { |
const Cycle = require('@cycle/core'); | |
const CycleWeb = require('@cycle/web'); | |
const makeHTTPDriver = require('@cycle/http'); | |
const h = CycleWeb.h; | |
function main(responses) { | |
const GITHUB_SEARCH_API = 'https://api.github.com/search/repositories?q='; | |
// This essentially models when search requests are supposed | |
// to happen |
import kotlin.browser.document | |
import kotlin.browser.window | |
// Type definitions | |
native("Cycle") | |
val Cycle : dynamic = noImpl | |
native("Cycle.h") | |
fun h(tagName: String) : VTree = noImpl |
import Cycle from 'cyclejs'; | |
const { h, Rx } = Cycle; | |
// all html/svg element names << | |
var elements = [ | |
'a', | |
'abbr', | |
'address', | |
'area', |