How to use the Subscription function from rxjs

Find comprehensive JavaScript rxjs.Subscription code examples handpicked from public code repositorys.

27
28
29
30
31
32
33
34
35
36
exports.animationFrame = rxjs.animationFrame;
exports.animationFrameScheduler = rxjs.animationFrameScheduler;
exports.VirtualTimeScheduler = rxjs.VirtualTimeScheduler;
exports.VirtualAction = rxjs.VirtualAction;
exports.Scheduler = rxjs.Scheduler;
exports.Subscription = rxjs.Subscription;
exports.Subscriber = rxjs.Subscriber;
exports.Notification = rxjs.Notification;
exports.NotificationKind = rxjs.NotificationKind;
exports.pipe = rxjs.pipe;
fork icon299
star icon0
watch icon1

337
338
339
340
341
342
343
344
345
346
HeaderComponent.prototype.attachTargets = function () {
    var _this = this;
    if (this.targetSubscription) {
        this.targetSubscription.unsubscribe();
    }
    this.targetSubscription = new rxjs_1.Subscription();
    var enterStream = rxjs_1.merge.apply(void 0, this.dropTargets.map(function (target) { return target.enter; }));
    var leaveStream = rxjs_1.merge.apply(void 0, this.dropTargets.map(function (target) { return target.leave; }));
    var dropStream = rxjs_1.merge.apply(void 0, this.dropTargets.map(function (target) { return target.drop; }));
    this.targetSubscription.add(enterStream.pipe(operators_1.tap(function (_a) {
fork icon0
star icon0
watch icon0

268
269
270
271
272
273
274
275
276
277
this.totalVisible = result.totalVisible;
if (result.observables && result.observables.length) {
    this.loading = true;
    this.loadingCount += result.observables.length;
    if (!this.childrenSubscription) {
        this.childrenSubscription = new rxjs_1.Subscription();
    }
    result.observables.forEach(function (o) {
        _this.loaded.set(o.parentId, LOADING);
        _this.childrenSubscription.add(o.observable.subscribe(function (children) {
fork icon0
star icon0
watch icon0

11
12
13
14
15
16
17
18
19
20
function BaseBindingDirective(treelist) {
    this.treelist = treelist;
    this.state = {};
    this.cache = new Map();
    this.originalData = [];
    this.subscriptions = new rxjs_1.Subscription();
    this.treelist.fetchChildren = this.fetchChildren.bind(this);
    this.treelist.hasChildren = this.hasChildren.bind(this);
}
Object.defineProperty(BaseBindingDirective.prototype, "sort", {
fork icon0
star icon0
watch icon0

215
216
217
218
219
220
221
222
223
224
    this._popupSettings = { animate: true };
    this.popupMouseDownHandler = function (event) { return event.preventDefault(); };
    this.customValueSubject = new rxjs_1.Subject();
    this.valueSubject = new rxjs_1.Subject();
    this.clearValueSubject = new rxjs_1.Subject();
    this.subs = new rxjs_1.Subscription();
    this.direction = localization.rtl ? 'rtl' : 'ltr';
    this.data = [];
}
Object.defineProperty(ComboBoxComponent.prototype, "width", {
fork icon0
star icon0
watch icon0

232
233
234
235
236
237
238
239
240
241
this._value = [];
this._popupSettings = { animate: true };
this._isFocused = false;
this.selectedDataItems = [];
this.customValueSubject = new rxjs_1.Subject();
this.observableSubscriptions = new rxjs_1.Subscription();
this.popupMouseDownHandler = this.onMouseDown.bind(this);
this.data = [];
this.direction = this.localization.rtl ? 'rtl' : 'ltr';
this.subscribeEvents();
fork icon0
star icon0
watch icon0

10
11
12
13
14
15
16
17
18
19
20
21
22


const isResultObservable2 = isObservable.subscribe(numbers => {
	console.log(`#2 Generate this number: ${numbers}`)
})


const isSubscription = new Subscription()


isSubscription.add(isResultObservable)
isSubscription.add(isResultObservable2)

fork icon0
star icon0
watch icon0