Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
History: captureClicks(makeHistoryDriver())
};
/// #else
driverFn = () => ({
DOM: restartable(makeDOMDriver('#app'), {
pauseSinksWhileReplaying: false
}),
HTTP: restartable(makeHTTPDriver()),
Time: timeDriver,
History: captureClicks(makeHistoryDriver())
});
/// #endif
export const driverNames: string[] = Object.keys(drivers || driverFn());
/// #if PRODUCTION
run(main as any, drivers);
// register service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/service-worker.js')
.then(registration => console.log('SW registration successful with scope: ', registration.scope));
}
/// #else
const rerun = rerunner(setup, driverFn, isolate);
rerun(main as any);
if (module.hot) {
module.hot.accept('./app', () => {
const newApp = require('./app').App;
rerun(onionify(newApp));
});
li('.li', '', ['Option 6'])
])
)
.compose(
makeSortable>(DOM, {
ghostClass: '.ghost',
selectionDelay: 500
})
);
return {
DOM: vdom$
};
}
run(main, {
DOM: makeDOMDriver('#app')
});
import './preloaded'
import { makeDOMDriver } from '@cycle/dom'
import { run } from '@cycle/run'
import 'normalize.css'
import App from './App'
import makeDOMRectDriver from './makeDOMRectDriver'
import makeFileDriver from './makeFileDriver'
import makeFileSaverDriver from './makeFileSaverDriver'
import makeKeyboardDriver from './makeKeyboardDriver'
import makeWindowEventDriver from './makeWindowEventDriver'
run(App, {
DOM: makeDOMDriver('#container'),
FILE: makeFileDriver(),
keyboard: makeKeyboardDriver(),
mouseup: makeWindowEventDriver('mouseup'),
mousemove: makeWindowEventDriver('mousemove'),
SAVE: makeFileSaverDriver(),
svgDOMRect: makeDOMRectDriver('.svg'),
})
import {run} from '@cycle/run';
import {makeDOMDriver} from '@cycle/dom';
import BmiCalculator from './BmiCalculator';
const main = BmiCalculator;
run(main, {
DOM: makeDOMDriver('#main-container'),
});
import {run} from '@cycle/run'
import {makeDOMDriver} from '@cycle/dom'
import onionify from 'cycle-onionify'
import Folder from './Folder'
const main = onionify(Folder)
run(main, {
DOM: makeDOMDriver('#app')
})
.compose(makeSortable>(DOM));
const update$ : Stream = getUpdateEvent(DOM, '.ul')
.map(o => 'You changed item Number ' + (o.oldIndex + 1) + ' to postion ' + (o.newIndex + 1))
.startWith('You havent changed anything yet')
.map(s => span('.span', s));
const vdom$ : Stream = xs.combine(sortable$, update$)
.map(arr => div([arr[0], arr[1]]));
return {
DOM: vdom$
};
}
run(main, {
DOM: makeDOMDriver('#app')
});
main = routerify(main, switchPath);
const drivers: any = {
DOM: makeDOMDriver('#app'),
HTTP: makeHTTPDriver(),
history: makeHashHistoryDriver(),
time: timeDriver
};
export const driverNames: string[] = Object.keys(drivers);
const sinks: (s: Sources) => any = sources => ({
...driverNames.map(n => ({ [n]: xs.never() })).reduce(Object.assign, {}),
...main(sources)
});
run(sinks, drivers);
li('.class', '', ['Option 4']),
li('.class', '', ['Option 5']),
li('.class', '', ['Option 6']),
])
])
)
.compose(makeSortable>(DOM, {
parentSelector: '.ul'
}));
return {
DOM: vdom$
};
}
run(main, {
DOM: makeDOMDriver('#app')
});
ul({style: ulStyle}, animStates.map(animState =>
li({style: {fontSize: `${animState.value * 50}px`}}, animState.key)
))
)
}
function main(sources) {
const key$ = intent(sources.Keydown)
const state$ = model(key$)
const vtree$ = view(state$, sources.Time)
return {
DOM: vtree$,
}
}
run(main, {
Keydown: () => fromEvent(document, 'keydown'),
DOM: makeDOMDriver('#main-container'),
Time: timeDriver
})
import {makeDOMDriver} from '@cycle/dom';
import app from './app';
function clientSideApp(sources) {
const sinks = app(sources);
sinks.DOM = sinks.DOM.drop(1);
return sinks;
}
function preventDefaultDriver(ev$) {
ev$.addListener({
next: ev => ev.preventDefault(),
});
}
run(clientSideApp, {
DOM: makeDOMDriver('.app-container'),
context: () => xs.of(window.appContext),
PreventDefault: preventDefaultDriver,
});