Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
super();
let loadDisposable = new Rx.SingleAssignmentDisposable();
this.addDisposable(loadDisposable);
this._stream = Rx.Observable.empty();
this._publishedStream = Rx.Observable.defer(() => {
// We close over _stream so that we allow the class to modify
// it (see registerStream function)
return this._stream;
})
// When we load, stop on the first error result we get
// But yield it back to the consumer so they know it stopped
.takeUntilInclusive((result: LoadResult) => result.stage === ResultStage.Error)
.multicast(new Rx.ReplaySubject(1))
.lazyConnect(loadDisposable);
}
function app(sources) {
return {
DOM: Rx.Observable.just(
h3('.top-most', [
sources.DOM.isolateSink(Rx.Observable.just(
div('.foo', [
h4('.bar', 'Wrong')
])
), 'ISOLATION'),
h2('.bar', 'Correct'),
])
)
};
}
var Rx = require("rx");
var Observable = Rx.Observable;
var _ = require("lodash");
var noOp = function() {};
var ErrorDataSource = module.exports = function(errorCode, errorMessage, errorData) {
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.errorData = errorData;
};
ErrorDataSource.prototype = {
get: function(paths) {
return Rx.Observable.throw({
$type: 'error',
value: _.assign({
status: this.errorCode,
"message": this.errorMessage
function model(actions) {
let columnSort$ = actions.columnSort$.startWith(defaultColumnSort);
let filterEvenRows$ = actions.filterEvenRows$.startWith(false);
let tableData$ = actions.tableData$.startWith(defaultTableData);
let columns$ = tableData$.map(data => data.columns);
let defaultColumnWidths$ = tableData$.map(data => data.defaultColumnWidths);
let rawRows$ = tableData$.map(data => data.rows);
let sortedRows$ = makeSortedRows$(rawRows$, columnSort$);
let rows$ = makeFilteredRows$(sortedRows$, filterEvenRows$);
let rowCount$ = rows$.map(rows => rows.length);
let tableHeight$ = Rx.Observable.just(500);
let rowHeight$ = Rx.Observable.just(30);
let scrollTop$ = actions.scrollTop$.startWith(0);
let visibleIndices$ = makeVisibleIndices$(
tableHeight$, rowHeight$, rowCount$, scrollTop$
);
let containerWidth$ = actions.containerWidth$.startWith(window.innerWidth);
let columnWidths$ = makeColumnWidths$(
defaultColumnWidths$,
containerWidth$
);
return Rx.Observable.combineLatest(
tableHeight$,
rowHeight$,
acc.active = payload;
return acc;
}
}, {count: 0, active: false})
.map(x => x.count);
const counter = isolate(Counter)({
DOM,
props$: counterCount$.map(count => ({count}))
});
/*
* View
*/
const vtree$ = Rx.Observable.combineLatest(
button.DOM, counter.DOM, viewer.DOM
)
.map(vtrees => div(vtrees));
/*
* Sinks
*/
return {DOM: vtree$, HTTP: viewer.HTTP};
}
const userInfoSteam = ($repos) => {
const $avator = $repos.find('.user_header');
const avatorMouseoverObservable = Rx.Observable.fromEvent($avator, 'mouseover')
.debounce(500)
.takeWhile((e) => {
const $infosWrapper = $(e.target).parent().find('.user_infos_wrapper');
return $infosWrapper.find('.infos_container').length === 0;
})
.map((e) => {
const $infosWrapper = $(e.target).parent().find('.user_infos_wrapper');
return {
conatiner: $infosWrapper,
url: $(e.target).attr('data-api')
}
})
.filter((data) => !!data.url)
.flatMapLatest(getUser)
.do((result) => {
const {data, conatiner} = result;
function readdir(dir) {
return Rx.Observable.create(function(observer) {
fs.readdir(dir, cb);
function cb(e, files) {
if(e) files = [];
files = _.map(files, _.partial(setFullPath, dir));
observer.onNext(files);
observer.onCompleted();
}
});
};
toObservable() {
return Rx.Observable.create((observer) => {
this.fork(x => {
observer.onNext(x);
observer.onCompleted();
}, e => {
observer.onError(e);
});
});
}
fromESObservable: observable => Rx.Observable.create(observer => {
const { unsubscribe } = observable.subscribe({
next: val => observer.onNext(val),
error: error => observer.onError(error),
complete: () => observer.onCompleted()
})
return unsubscribe
}),
toESObservable: rxObservable => ({