Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
driverFn = () => ({
DOM: restartable(makeDOMDriver('#app'), {
pauseSinksWhileReplaying: false
}),
HTTP: restartable(makeHTTPDriver()),
Time: timeDriver,
History: captureClicks(makeHistoryDriver())
});
/// #endif
import { Observable as O } from './rxjs'
import main from './app'
const apiBase = (process.env.API_URL || '/api').replace(/\/+$/, '')
, webBase = process.env.BASE_HREF || '/'
, initTitle = process.browser ? document.title : process.env.SITE_TITLE
const titleDriver = title$ => O.from(title$)
.subscribe(title => document.title = title ? `${title} · ${initTitle}` : initTitle)
run(main, {
DOM: makeDOMDriver('#explorer')
, HTTP: makeHTTPDriver()
, route: makeRouteDriver(captureClicks(makeHistoryDriver({ basename: webBase })))
, storage: storageDriver
, search: makeSearchDriver(apiBase)
, title: titleDriver
, scanner: makeScanDriver()
})
return {
DOM: vdom$
, HTTP: rpc.toHttp(serverInfo, rpc$)
, route: navto$
, conf$: state$.map(s => s.conf)
, scan$: scanner$
, orient$
, notif$
}
}
run(main, {
DOM: makeDOMDriver('#app')
, SSE: makeSSEDriver(serverInfo)
, HTTP: makeHTTPDriver()
, route: makeRouteDriver(captureClicks(makeHashHistoryDriver()))
, conf$: makeConfDriver(storageDriver)
, orient$: orientDriver
, ...(
process.env.BUILD_TARGET == 'cordova' ? {
urihandler$: require('./driver/cordova-urihandler')
, scan$: require('./driver/cordova-qrscanner')
, notif$: require('./driver/cordova-notification')
}
: process.env.BUILD_TARGET == 'electron' ? {
urihandler$: require('./driver/electron-urihandler')
, scan$: require('./driver/instascan')({ mirror: false, backgroundScan: false })
, notif$: require('./driver/electron-notification')
}