MCPcopy Create free account
hub / github.com/cyclejs/cyclejs / isolate

Function isolate

isolate/src/index.ts:105–115  ·  view source on GitHub ↗

* Takes a `component` function and an optional `scope` string, and returns a * scoped version of the `component` function. * * When the scoped component is invoked, each source provided to the scoped * component is isolated to the given `scope` using * `source.isolateSource(source, scope)`, if

(component: Component<SmallSo, SmallSi>,
                                   scope: any = newScope())

Source from the content-addressed store, hash-verified

103 * @function isolate
104 */
105function isolate<SmallSo, SmallSi>(component: Component<SmallSo, SmallSi>,
106 scope: any = newScope()): Component<BigSo, BigSi> {
107 checkIsolateArgs(component, scope);
108 const convertedScope: string = typeof scope === 'string' ? scope : scope.toString();
109 return function scopedComponent(sources: BigSo, ...rest: Array<any>): BigSi {
110 const scopedSources = isolateAllSources(sources, convertedScope);
111 const sinks = component(scopedSources, ...rest);
112 const scopedSinks = isolateAllSinks(sources, sinks, convertedScope);
113 return scopedSinks;
114 };
115}
116
117(isolate as any).reset = () => counter = 0;
118

Callers 13

appFunction · 0.85
isolation.tsFile · 0.85
mainFunction · 0.85
ParentFunction · 0.85
appFunction · 0.85
ItemFunction · 0.85
TickerWrapperFunction · 0.85
index.tsFile · 0.85
ChildrenFunction · 0.85
FolderFunction · 0.85
IsolatedLabeledSliderFunction · 0.85
makeItemWrapperFunction · 0.85

Calls 5

newScopeFunction · 0.85
checkIsolateArgsFunction · 0.85
isolateAllSourcesFunction · 0.85
componentFunction · 0.85
isolateAllSinksFunction · 0.85

Tested by

no test coverage detected