Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export interface CycleProgram<
D extends MatchingDrivers,
M extends MatchingMain
> {
sources: ToMostStreams>;
sinks: Sinks;
run(): DisposeFunction;
}
export interface Engine {
sources: Sources;
run>(sinks: Sinks): DisposeFunction;
dispose(): void;
}
setAdapt(function adaptXstreamToMost(stream: Stream): MostStream {
return most.from(stream as any);
});
/**
* Takes a `main` function and circularly connects it to the given collection
* of driver functions.
*
* **Example:**
* ```js
* import run from '@cycle/most-run';
* const dispose = run(main, drivers);
* // ...
* dispose();
* ```
*
* The `main` function expects a collection of "source" streams (returned from
import model from './model'
import view from './view'
import rpc from './rpc'
if (process.env.BUILD_TARGET === 'web') {
require('pwacompat')
}
// Send Cordova/Electron users directly to server settings if there are none
if (process.env.BUILD_TARGET !== 'web' && !localStorage.serverInfo) {
location.href = 'settings.html' // @xxx side-effects outside of drivers
throw new Error('Missing server settings, redirecting')
}
// Get cyclejs to use rxjs-compat-enabled streams
require("@cycle/run/lib/adapt").setAdapt(stream$ => O.from(stream$))
const serverInfo = process.env.BUILD_TARGET === 'web'
? { serverUrl: '.', accessKey: document.querySelector('[name=access-key]').content }
: JSON.parse(localStorage.serverInfo)
const main = ({ DOM, HTTP, SSE, route, conf$, scan$, urihandler$ }) => {
const actions = intent({ DOM, route, conf$, scan$, urihandler$ })
, resps = rpc.parseRes({ HTTP, SSE })
, state$ = model({ HTTP, ...actions, ...resps })
, rpc$ = rpc.makeReq(actions)
, vdom$ = view.vdom({ state$, ...actions, ...resps })
, navto$ = view.navto({ ...resps, ...actions })
, notif$ = view.notif({ state$, ...resps })
import urlutil from 'url'
import run from '@cycle/rxjs-run'
import serialize from 'form-serialize'
import { Observable as O } from './rxjs'
import { makeDOMDriver } from '@cycle/dom'
import { makeHashHistoryDriver, captureClicks } from '@cycle/history'
import storageDriver from '@cycle/storage'
// Get cyclejs to use rxjs-compat-enabled streams
require("@cycle/run/lib/adapt").setAdapt(stream$ => O.from(stream$))
import makeRouteDriver from './driver/route'
import makeConfDriver from './driver/conf'
import { combine, dbg } from './util'
import { layout } from './views/layout'
import view from './views/server-settings'
// Settings manager for Cordova/Electron builds.
// This is a standalone cycle app loaded using a separate HTML file (settings.html).
const main = ({ DOM, IPC, storage, route, conf$, scan$ }) => {
const
on = (sel, ev, pd=false) => DOM.select(sel).events(ev, { preventDefault: pd })
export interface CycleProgram<
D extends MatchingDrivers,
M extends MatchingMain
> {
sources: ToObservables>;
sinks: Sinks;
run(): DisposeFunction;
}
export interface Engine {
sources: Sources;
run>(sinks: Sinks): DisposeFunction;
dispose(): void;
}
setAdapt(function adaptXstreamToRx(stream: Stream): Observable {
return from(stream as any);
});
/**
* Takes a `main` function and circularly connects it to the given collection
* of driver functions.
*
* **Example:**
* ```js
* import run from '@cycle/rxjs-run';
* const dispose = run(main, drivers);
* // ...
* dispose();
* ```
*
* The `main` function expects a collection of "source" Observables (returned