Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function replicateAllInteraction$(input, proxy) {
let subscriptions = new Rx.CompositeDisposable();
let selectors = proxy._interaction$;
for (let selector in selectors) { if (selectors.hasOwnProperty(selector)) {
let elemEvents = selectors[selector];
for (let eventName in elemEvents) { if (elemEvents.hasOwnProperty(eventName)) {
let event$ = input.choose(selector, eventName);
if (event$ !== null) {
let subscription = replicate(event$, elemEvents[eventName]);
subscriptions.add(subscription);
}
}}
}}
return subscriptions;
}
function subscribeDispatchers(element) {
let {customEvents} = element.cycleCustomElementMetadata;
let disposables = new Rx.CompositeDisposable();
for (let name in customEvents) { if (customEvents.hasOwnProperty(name)) {
if (typeof customEvents[name].subscribe === 'function') {
let disposable = customEvents[name].subscribe(
makeDispatchFunction(element, name)
);
disposables.add(disposable);
}
}}
return disposables;
}
subscribeToStoreKeypath(props) {
this.disposeStoreKeypathSubscription();
const keypathMap = getKeypath(props);
for (const [key, keypath] of entries(keypathMap)) {
this.observableMap[key] = oop.observe(keypath);
}
if (transform) {
this.observableMap = transform(this.observableMap);
}
this.disposableBag = new CompositeDisposable();
Object.keys(this.observableMap).forEach((key) => {
const disposable = this.observableMap[key].subscribe((val) => this.setState({[key]: val}));
this.disposableBag.add(disposable);
});
}
return Rx.Observable.createWithDisposable(function(observer) {
var key = keySelector();
var cache = cacheSelector();
if(cache.hasOwnProperty(key) === false) cache[key] = source.replay().refCount();
var subscriptions = new Rx.CompositeDisposable();
var cacheObservable = Rx.Observable.switchCase(keySelector, cache);
var durationObservable = durationSelector(key);
var durationSubscription = durationObservable.take(1).subscribe(function(){}, null, function(){
delete cache[key];
});
var switchSubscription = cacheObservable.subscribe(observer);
subscriptions.add(durationSubscription);
subscriptions.add(switchSubscription);
return subscriptions;
});
});
return Observable.create(observer => {
let buffers: Event[][] = _.map(observables, o => []);
let completed:boolean[] = _.map(observables, o => false);
let disposable = new CompositeDisposable();
_.forEach(observables, (observable, i) => {
disposable.add(observable.subscribe(event => {
buffers[i].push(event);
if (observablesHaveEmitted(buffers, completed)) {
let item = getLowestItem(buffers);
if (item) observer.onNext(item);
}
}, error => {
observer.onError(error);
}, () => {
completed[i] = true;
if (_.every(completed, completion => completion)) {
let flushed = false;
while (!flushed) {
let item = getLowestItem(buffers);
constructor(...args) {
super(...args);
this._subscriptions = new CompositeDisposable();
}
let longTouch = touchStart.flatMap(e =>
Rx.Observable
.return(e)
.delay(triggerLongPressEventAfter)
.takeUntil(
touchMove
.merge(touchEnd)
.first(x => x.identifier === e.identifier)
)
);
let touchStartComposite = new Rx.CompositeDisposable();
let touchMoveComposite = new Rx.CompositeDisposable();
let touchEndComposite = new Rx.CompositeDisposable();
let touchPressComposite = new Rx.CompositeDisposable();
let longTouchComposite = new Rx.CompositeDisposable();
touchStartComposite.add(
touchStart
.groupBy(e => e.identifier)
.map(group => {
return group.map(e => {
touches.push({
id: group.key,
type: "start",
event: e
});
});
})
.subscribe(group => {
touchStartComposite.add(group.subscribe());
const connect = () => {
const allDisposable = new Rx.CompositeDisposable();
const children = getChildrenSubject && getChildrenSubject.getValue();
if (children) {
const keys = Object.keys(children);
keys.forEach(key => allDisposable.add(
children[key].getValue().connect()
));
}
allDisposable.add(
asObservable().connect()
);
return allDisposable;
};