Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import { constant, scan, merge, tap, runEffects } from '@most/core'
import { newDefaultScheduler } from '@most/scheduler'
import { click } from '@most/dom-event'
import { qs } from '../../common'
const incButton = qs('[name=inc]', document)
const decButton = qs('[name=dec]', document)
const value = qs('.value', document)
const inc = constant(1, click(incButton))
const dec = constant(-1, click(decButton))
const counter = scan((total, delta) => total + delta, 0, merge(inc, dec))
const render = tap(total => { value.innerText = String(total) }, counter)
runEffects(render, newDefaultScheduler())
// @flow
import { constant, scan, merge, tap, runEffects } from '@most/core'
import { newDefaultScheduler } from '@most/scheduler'
import { click } from '@most/dom-event'
import { qs } from '../../common'
const incButton = qs('[name=inc]', document)
const decButton = qs('[name=dec]', document)
const value = qs('.value', document)
const inc = constant(1, click(incButton))
const dec = constant(-1, click(decButton))
const counter = scan((total, delta) => total + delta, 0, merge(inc, dec))
const render = tap(total => { value.innerText = String(total) }, counter)
runEffects(render, newDefaultScheduler())
// @flow
import { constant, scan, merge, tap, runEffects } from '@most/core'
import { newDefaultScheduler } from '@most/scheduler'
import { click } from '@most/dom-event'
import { qs } from '../../common'
const incButton = qs('[name=inc]', document)
const decButton = qs('[name=dec]', document)
const value = qs('.value', document)
const inc = constant(1, click(incButton))
const dec = constant(-1, click(decButton))
const counter = scan((total, delta) => total + delta, 0, merge(inc, dec))
const render = tap(total => { value.innerText = String(total) }, counter)
runEffects(render, newDefaultScheduler())
// @flow
import { constant, scan, merge, tap, runEffects } from '@most/core'
import { newDefaultScheduler } from '@most/scheduler'
import { click } from '@most/dom-event'
import { qs } from '../../common'
const incButton = qs('[name=inc]', document)
const decButton = qs('[name=dec]', document)
const value = qs('.value', document)
const inc = constant(1, click(incButton))
const dec = constant(-1, click(decButton))
const counter = scan((total, delta) => total + delta, 0, merge(inc, dec))
const render = tap(total => { value.innerText = String(total) }, counter)
runEffects(render, newDefaultScheduler())
export function switchCombine<a>(
streams$: Stream>>): Stream>
{
return switchLatest(
map(
(streams) => streams.length === 0 ?
just([]) :
combineArray(Array, streams as Array>),
streams$,
),
)
}
</a>
export function switchCombine<a>(
streams$: Stream>>): Stream>
{
return switchLatest(
map(
(streams) => streams.length === 0 ?
just([]) :
combineArray(Array, streams as Array>),
streams$,
),
)
}
</a>
export const drain = <a>(stream: Stream</a><a>) => runEffects(stream, scheduler)
</a>
import { newDefaultScheduler } from '@most/scheduler'
import { click } from '@most/dom-event'
import { qs } from '../../common'
const incButton = qs('[name=inc]', document)
const decButton = qs('[name=dec]', document)
const value = qs('.value', document)
const inc = constant(1, click(incButton))
const dec = constant(-1, click(decButton))
const counter = scan((total, delta) => total + delta, 0, merge(inc, dec))
const render = tap(total => { value.innerText = String(total) }, counter)
runEffects(render, newDefaultScheduler())
export function switchMerge<a>(
streams$: Stream>>): Stream>
{
return switchLatest>(
map(
(streams) => streams.length === 0 ? just([]) : mergeArray(streams),
streams$,
),
)
}
</a>
const out = epic(actionsStream, middlewareApiOrStateStream)
if (!out || !out.source) {
const epicIdentifier = epic.name
? `named ${epic.name}`
: `at index ${findIndex(epic, epicsArray)} of the passed in array`
throw new TypeError(
`All Epics in the array provided to combineEpics must return a stream. Check the return value of the Epic ${epicIdentifier}.`,
)
}
return out
}
return mergeArray(map(callEpic, epicsArray))
}