Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// single item
return collection.add(sourcesList);
}
});
const removeReducer$ = removeProxy$.map(item => collection => collection.remove(item));
const reducer$ = xs.merge(removeReducer$, addReducer$);
const emptyCollection = collection({ component, sources, removeSelector });
const collection$ = reducer$
.fold((collection, reducer) => reducer(collection), emptyCollection)
.map(collection => collection.asArray());
const remove$ = Collection.merge(collection$, item => item._remove$, true);
removeProxy$.imitate(remove$);
return adapt(collection$);
}
key(n: number) {
return adapt(storageKey(n, request$, type));
},
// Function returning stream of item values.
const sandbox: ISpawn = (
resource,
sources,
bridges = {}
) => {
let channels: MessageChannels;
let subscription: FantasySubscription;
let worker: Worker;
let receivePorts: MessagePorts = {};
const instanceId = uuid();
return adapt(xs.create({
start (observer) {
const sourceKeys = Object.keys(sources);
channels = createChannels(sourceKeys);
// { DOM: channel}
worker = open(resource);
// make a object of destination ports (rx in thread) wiil be transfered to thread
const transferPorts = portMap(channels, 2);
// make a object of entry ports (tx in main)
const sendPorts = portMap(channels, 1);
const message: SandboxMessage = {
cmd: SandboxMessageCommand.init,
ports: transferPorts,
.path('/some')
.path('/nested')
.define(defintion);
match$.subscribe(({ path, value, location }) => {
assert.strictEqual(path, '/correct/route');
assert.strictEqual(value, 123);
assert.strictEqual(
location.pathname,
'/some/nested/correct/route'
);
done();
});
return {};
};
routerify(app, switchPath)({
history: adapt(
makeServerHistoryDriver()(
of('/wrong/path', '/some/nested/correct/route').pipe(
delay(0)
)
)
)
});
});
return function(sources: Sources): Sinks {
const messageProxy$: Stream = xs.create();
const parentSinks: Sinks = main({
...sources,
[name]: adapt(messageProxy$)
});
const sinks: Sinks = Object.keys(parentSinks)
.map(k => ({ [k]: xs.fromObservable(parentSinks[k]) }))
.reduce((prev, curr) => Object.assign(prev, curr), {});
if (sinks[name]) {
const modalProxy$: Stream = xs.create();
const modalStack$: Stream = xs
.merge(sinks[name] as Stream, modalProxy$)
.fold((acc, curr) => {
if (curr.type === 'close') {
const count: number = curr.count || 1;
return acc.slice(0, Math.max(acc.length - count, 0));
} else if (curr.type === 'open') {
const _sources: Sources =
constructor(html$: Stream, private _name: string) {
this._html$ = html$;
this._empty$ = adapt(xs.empty());
}
define(
routes: RouteDefinitionsMap | RouteDefinitionsArray,
routeMatcher?: RouteMatcher
): any {
const _createHref = this._createHref;
const createHref = util.makeCreateHref(this._namespace, _createHref);
const out$ = adapt(this._define(routes, routeMatcher));
out$.createHref = createHref;
return out$;
}
listener.complete();
},
};
stream.addListener(animationListener);
frame$.addListener(frameListener);
},
stop() {
if (animationListener) {
stream.removeListener(animationListener);
}
},
});
return adapt(throttledStream);
};
}
const rootElementWithDefaults = Object.assign(
{},
defaults,
rootElement
)
const instructions = translateVtreeToInstructions(rootElementWithDefaults)
renderInstructionsToCanvas(instructions, context)
},
error: e => { throw e },
complete: () => null
})
return adapt(xs.empty())
}
function isolateAllSinks(
sources: So,
innerSinks: Si,
scopes: ScopesPerChannel
): Si {
const outerSinks = {} as Si;
for (const channel in innerSinks) {
const source = sources[channel] as IsolateableSource;
const innerSink = innerSinks[channel];
if (
innerSinks.hasOwnProperty(channel) &&
source &&
scopes[channel] !== null &&
typeof source.isolateSink === 'function'
) {
outerSinks[channel] = adapt(
source.isolateSink(xs.fromObservable(innerSink as any), scopes[channel])
);
} else if (innerSinks.hasOwnProperty(channel)) {
outerSinks[channel] = innerSinks[channel];
}
}
return outerSinks;
}