Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const producer = {
start: (listener) => {
listener.next(1);
listener.next(2);
listener.next(3);
listener.complete();
},
stop: console.log
};
const create: Stream = xs.create(producer);
const createWithMemory: MemoryStream = xs.createWithMemory(producer);
const never: Stream<*> = xs.never();
const empty: Stream<*> = xs.empty();
const _throw: Stream<*> = xs.throw(new Error(123));
const from1: Stream = xs.from([1]);
const from2: Stream = xs.from(Promise.resolve(1));
const of: Stream = xs.of(1);
const fromArray: Stream = xs.fromArray([1,2,3]);
const fromPromise: Stream = xs.from(Promise.resolve(1));
const periodic: Stream = xs.periodic(123);
const merge: Stream = xs.merge(of, of);
const merge2: Stream = xs.merge(of, of, of, of);
const combine: Stream = xs.combine(of, of);
const combine2: Stream = xs.combine(of, of, of, of);
const listener = {
next: console.log,
error: console.error,
complete: console.log
};
let main = () => ({
bot: xs.from([
xs.of(getUserProfilePhotos(
{ user_id: 39759851 },
{}))
])
})
let { sources, run } = Cycle(main, { bot: basicDriver })
return isolate((sources) => {
const sinks$ = xs.from(sandbox(resource, sources, connectors));
return expectedSinks.reduce((acc, key) => ({
...acc,
[key]: adapt(sinks$.debug('sinks').map((sinks) => xs.from(sinks[key])).flatten())
}), {});
})(sources);
}
const data = () => xs.from>(dataObservable)
.map(sink => xs.from(sink[driver]))
return isolate((sources) => {
const sinks$ = xs.from(sandbox(resource, sources, bridges));
return expectedSinks.reduce((acc, key) => ({
...acc,
[key] : adapt(sinks$.debug('sinks').map((sinks) => xs.from(sinks[key])).flatten())
}), {});
})(sources);
}
[key]: adapt(sinks$.debug('sinks').map((sinks) => xs.from(sinks[key])).flatten())
}), {});
[key] : adapt(sinks$.debug('sinks').map((sinks) => xs.from(sinks[key])).flatten())
}), {});
return xs.create({
start(listener: Partial>) {
unsubscribe = store.addActionListener(
actionOrSelector,
listener.next.bind(listener)
)
},
stop() {
unsubscribe()
}
})
}
if (typeof actionOrSelector === 'function') {
return xs
.from(store)
.map(actionOrSelector)
.compose(dropRepeats())
}
}
}
next (message) {
if (message.cmd === WorkerDOMMessageCommand.vnode) {
const vnode = message.payload as VNode;
observer.next(vnode);
} else if (message.cmd === WorkerDOMMessageCommand.attach) {
const payload = message.payload as WorkerDOMAttachMessage;
const options = payload.options || {};
attachments[payload.listenerId] = (xs.from(source
.select(payload.selector)
.events(payload.events, options.useCapture)) as FantasyObservable)
.subscribe({
next (event: Event) {
if (options.preventDefault) {
event.preventDefault();
}
if (options.stopPropegation) {
event.stopPropagation();
}
tx.postMessage(
synthesizeEvent(event, payload.listenerId)
)
},
error (e) {