rxjs#Subscription TypeScript Examples
The following examples show how to use
rxjs#Subscription.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts From gnosis.1inch.exchange with MIT License | 6 votes |
public _subscribe(subscriber: Subscriber<T>): Subscription {
// Hook into the subscribe method to trigger refreshing
this._triggerProviderIfRequired();
return super._subscribe(subscriber);
}
Example #2
Source File: app.component.ts From xBull-Wallet with GNU Affero General Public License v3.0 | 6 votes |
createWalletsOperationsQuery: Subscription = this.accountWithHorizonQuery$
.subscribe(([account, horizonApi]) => {
this.walletsAccountsService.createOperationsStream({
account,
order: 'asc',
cursor: 'now',
horizonApi
});
});
Example #3
Source File: gas-refund.component.ts From rubic-app with GNU General Public License v3.0 | 6 votes |
private notify(tradeStatus: 'progress' | 'complete'): Subscription {
const notificationsData = {
progress: {
message: 'gasRefund.notifications.progress.message',
label: 'gasRefund.notifications.progress.label',
tuiStatus: TuiNotification.Info,
autoClose: false
},
complete: {
message: 'gasRefund.notifications.complete.message',
label: 'gasRefund.notifications.complete.label',
tuiStatus: TuiNotification.Success,
autoClose: 5000
}
};
const notificationData = notificationsData[tradeStatus];
return this.notificationsService.show(this.translateService.instant(notificationData.message), {
label: this.translateService.instant(notificationData.label),
status: notificationData.tuiStatus,
autoClose: notificationData.autoClose
});
}
Example #4
Source File: ng-zone-decorators.ts From scion-microfrontend-platform with Eclipse Public License 2.0 | 6 votes |
public decorate(delegate: MessageClient): MessageClient {
const zone = this._zone;
return new class implements MessageClient {
public publish<T = any>(topic: string, message?: T, options?: PublishOptions): Promise<void> {
return delegate.publish(topic, message, options);
}
public request$<T>(topic: string, request?: any, options?: RequestOptions): Observable<TopicMessage<T>> {
return delegate.request$<T>(topic, request, options).pipe(synchronizeWithAngular(zone));
}
public observe$<T>(topic: string): Observable<TopicMessage<T>> {
return delegate.observe$<T>(topic).pipe(synchronizeWithAngular(zone));
}
public onMessage<IN = any, OUT = any>(topic: string, callback: (message: TopicMessage<IN>) => Observable<OUT> | Promise<OUT> | OUT | void): Subscription {
return delegate.onMessage(topic, callback);
}
public subscriberCount$(topic: string): Observable<number> {
return delegate.subscriberCount$(topic).pipe(synchronizeWithAngular(zone));
}
};
}
Example #5
Source File: home.component.ts From one-platform with MIT License | 5 votes |
dashboardServiceSub: Subscription;
Example #6
Source File: app.component.ts From gnosis.1inch.exchange with MIT License | 5 votes |
private subscription = new Subscription();
Example #7
Source File: add-service.page.ts From Uber-ServeMe-System with MIT License | 5 votes |
private homeServiceSubscription: Subscription;
Example #8
Source File: CharBlockCache.ts From grid-engine with Apache License 2.0 | 5 votes |
private positionChangeStartedSubs: Map<string, Subscription> = new Map();
Example #9
Source File: tutorial-dialog.component.ts From bdc-walkthrough with MIT License | 5 votes |
componentSubscription: Subscription;
Example #10
Source File: copy-headings.tsx From codedoc with MIT License | 5 votes |
export function copyHeadings() {
const renderer = getRenderer();
onReady(() => {
let sub: Subscription;
const _exec = () => {
if (sub) sub.unsubscribe();
sub = new Subscription();
document.querySelectorAll('h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]').forEach(heading$ => {
const link = headingLink(heading$);
if (link) {
const click$ = fromEvent(heading$, 'mousedown').pipe(
filter(event => (event as MouseEvent).button === 0),
concatMap(start =>
fromEvent(heading$, 'mouseup').pipe(
take(1),
map(end => [start, end])
)
)
);
sub.add(
click$.pipe(
buffer(click$.pipe(debounceTime(200))),
filter(buffer => buffer.length === 1),
map(buffer => buffer[0]),
)
.subscribe(([start, end]) => {
const [ms, me] = [start as MouseEvent, end as MouseEvent];
const dx = ms.clientX - me.clientX;
const dy = ms.clientY - me.clientY;
if (Math.sqrt(dx * dx + dy * dy) < 10) {
copyToClipboard(link, () => renderer.render(<Toast>
Link Copied to Clipboard!
</Toast>).on(document.body));
};
})
);
}
});
};
_exec(); window.addEventListener('navigation', _exec);
});
}
Example #11
Source File: ToggleableSubscriber.ts From clarity with Apache License 2.0 | 5 votes |
@observable eventsSubscriber: Subscription | null = null;
Example #12
Source File: typer.component.ts From TypeFast with MIT License | 5 votes |
private secondTimer: Subscription;
Example #13
Source File: stompx.ts From chatkitty-js with MIT License | 5 votes |
private readonly topics: Map<string, Subscription> = new Map();
Example #14
Source File: app.component.ts From xBull-Wallet with GNU Affero General Public License v3.0 | 5 votes |
updateAlertsLabelsSuscription: Subscription = timer(0, 15000)
.pipe(switchMap(_ => this.alertsLabelsService.getAlertsLabelsByCreitTech()))
.subscribe();
Example #15
Source File: rubic-menu.component.ts From rubic-app with GNU General Public License v3.0 | 5 votes |
private _onNetworkChanges$: Subscription;