Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.scan((prevPage, navi) => {
// Unsubscribe previous page (if there was)
if (prevPage.subscriptions) {
prevPage.subscriptions.forEach((s) => s.dispose())
}
// Make disposable sinks
let sinkProxies = {
DOM: new ReplaySubject(1),
log: new ReplaySubject(1),
}
// Run page
let sinks = merge({
log: $.empty(), // affects log
DOM: $.empty(), // affects DOM
}, navi.page(src))
// Subscribe current page
let subscriptions = [
sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
sinks.log.subscribe(sinkProxies.log.asObserver()),
]
return {navi, sinks: sinkProxies, subscriptions}
}, {})
.pluck("sinks")
if (prevPage && prevPage.subscriptions) {
prevPage.subscriptions.forEach((s) => s.dispose())
}
// Make disposable sinks
let sinkProxies = {
redirect: new ReplaySubject(1),
update: new ReplaySubject(1),
DOM: new ReplaySubject(1),
log: new ReplaySubject(1),
state2: new ReplaySubject(1),
}
// Run page
let sinks = merge({
redirect: $.empty(), // affects navi
update: $.empty(), // affects state
log: $.empty(), // affects log
DOM: $.empty(), // affects DOM
state2: $.empty(), // nested state loop
}, navi.page(merge(src, {state2: sinkProxies.state2})))
// Subscribe current page
let subscriptions = [
sinks.redirect.subscribe(sinkProxies.redirect.asObserver()),
sinks.update.subscribe(sinkProxies.update.asObserver()),
sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
sinks.log.subscribe(sinkProxies.log.asObserver()),
sinks.state2.subscribe(sinkProxies.state2.asObserver()),
]
return {navi, sinks: sinkProxies, subscriptions}
prevPage.subscriptions.forEach((s) => s.dispose())
}
// Make disposable sinks
let sinkProxies = {
redirect: new ReplaySubject(1),
update: new ReplaySubject(1),
DOM: new ReplaySubject(1),
log: new ReplaySubject(1),
state2: new ReplaySubject(1),
}
// Run page
let sinks = merge({
redirect: $.empty(), // affects navi
update: $.empty(), // affects state
log: $.empty(), // affects log
DOM: $.empty(), // affects DOM
state2: $.empty(), // nested state loop
}, navi.page(merge(src, {state2: sinkProxies.state2})))
// Subscribe current page
let subscriptions = [
sinks.redirect.subscribe(sinkProxies.redirect.asObserver()),
sinks.update.subscribe(sinkProxies.update.asObserver()),
sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
sinks.log.subscribe(sinkProxies.log.asObserver()),
sinks.state2.subscribe(sinkProxies.state2.asObserver()),
]
return {navi, sinks: sinkProxies, subscriptions}
}, {})
}
// Make disposable sinks
let sinkProxies = {
redirect: new ReplaySubject(1),
update: new ReplaySubject(1),
DOM: new ReplaySubject(1),
log: new ReplaySubject(1),
state2: new ReplaySubject(1),
}
// Run page
let sinks = merge({
redirect: $.empty(), // affects navi
update: $.empty(), // affects state
log: $.empty(), // affects log
DOM: $.empty(), // affects DOM
state2: $.empty(), // nested state loop
}, navi.page(merge(src, {state2: sinkProxies.state2})))
// Subscribe current page
let subscriptions = [
sinks.redirect.subscribe(sinkProxies.redirect.asObserver()),
sinks.update.subscribe(sinkProxies.update.asObserver()),
sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
sinks.log.subscribe(sinkProxies.log.asObserver()),
sinks.state2.subscribe(sinkProxies.state2.asObserver()),
]
return {navi, sinks: sinkProxies, subscriptions}
}, {})
::history(2)
let sinkProxies = {
update: new ReplaySubject(1),
update2: new ReplaySubject(1),
DOM: new ReplaySubject(1),
log: new ReplaySubject(1),
}
// Run page
let sources = {
update2: sinkProxies.update2.delay(1),
navi: navi.delay(1),
state: state.delay(1),
DOM: src.DOM,
}
let sinks = merge({
update: $.empty(),
update2: $.empty(),
DOM: $.empty(),
log: $.empty(),
}, _navi.page(sources))
// Subscribe current page
let subscriptions = [
sinks.update.subscribe(sinkProxies.update.asObserver()),
sinks.update2.subscribe(sinkProxies.update2.asObserver()),
sinks.DOM.subscribe(sinkProxies.DOM.asObserver()),
sinks.log.subscribe(sinkProxies.log.asObserver()),
]
return {navi: _navi, sinks: sinkProxies, subscriptions}
}, {})
::history(2)
execute(query: IQuery): Rx.Observable {
return Observable.empty();
}
snapshotRepository.setup(s => s.saveSnapshot("test", It.isValue(new Snapshot(66, new Date(5000))))).returns(a => Observable.empty());
subject.run();
const pinchMove$ = globalEvents
.events('touchmove');
const touchAction$ = touchZoom({
pinchStart$, pinchMove$, pinchEnd$,
owner$, positionFn,
});
const wheelAction$ = wheelZoom({wheel$, owner$, positionFn});
return {
action$: O.merge([
touchAction$,
wheelAction$,
]).share(),
stopPropagation: O.empty(),
preventDefault: wheel$,
};
};
export default ({
DOM, globalEvents, visible$,
table$ = O.empty(),
formula$ = O.empty(),
}) => {
const {isolateSource, isolateSink} = DOM;
const actions = intent({DOM: isolateSource(DOM, 'modalBody')});
const state$ = model(table$, formula$, actions);
const modal = isolate(ModalBox, 'modal')({
DOM,
globalEvents,
props$: visible$.map((visible) => ({visible})),
content$: isolateSink(view(state$), 'modalBody'),
});
return {
DOM: modal.DOM.map(wrapInDiv),
selectAll: actions.selectAll$,
};
events (eventType) {
const mockConfig = this._mockConfig
const keys = Object.keys(mockConfig)
const keysLen = keys.length
for (let i = 0; i < keysLen; i++) {
const key = keys[i]
if (key === eventType) {
return mockConfig[key]
}
}
return Observable.empty()
}