本文整理汇总了TypeScript中rxjs/Rx.Subscription.unsubscribe方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Subscription.unsubscribe方法的具体用法?TypeScript Subscription.unsubscribe怎么用?TypeScript Subscription.unsubscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rxjs/Rx.Subscription
的用法示例。
在下文中一共展示了Subscription.unsubscribe方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
this.taskListService.getUserLists().subscribe((taskListsObservable) => {
if (this.taskListsSubscription != null) {
this.taskListsSubscription.unsubscribe();
}
this.taskListsSubscription =
taskListsObservable.subscribe((taskLists) => { this.taskLists = taskLists; });
});
示例2: ngOnDestroy
ngOnDestroy()
{
const me = this.constructor.name + '.ngOnDestroy(): ';
console.log( me);
if (this._currentClusterSubscription)
this._currentClusterSubscription.unsubscribe();
}
示例3: runPreIFrameTasks
runPreIFrameTasks() {
if (this._preIFrameTasks && this._preIFrameTasks.isUnsubscribed) {
this._preIFrameTasks.unsubscribe();
}
this._preIFrameTasks = Observable.timer(0, 60000)
.concatMap<string>(() => this._http.get('api/token?plaintext=true').retry(5).map<string>(r => r.text()))
.subscribe(t => this._userService.setToken(t));
}
示例4:
(navTabName: string) => {
if( navTabName !== name && !this.vhostTreeSubs.isUnsubscribed ) { // 플레이어 탭이 아닐 때
this.vhostTreeSubs.unsubscribe();
this.stopAllPlayers();
}
else {
this.subscribeVhostTree();
this.reloadAllPlayers();
}
}
示例5: Subscription
return Observable.create(o => {
log.debug(
`Doing a RPC to [${remoteProcedure}]. Is connected [${this
.isConnected}]`
)
const disposables = new Subscription()
if (!this.isConnected) {
o.error(
new Error(
`Session not connected, can\'t perform remoteProcedure ${remoteProcedure}`
)
)
return disposables
}
let isDisposed
const dto = [
{
payload,
replyTo: responseTopic,
Username: this.userName
}
]
this.autobahn.session.call(remoteProcedure, dto).then(
result => {
if (!isDisposed) {
o.next(result)
o.complete()
} else {
log.verbose(
`Ignoring response for remoteProcedure [${remoteProcedure}] as stream disposed`
)
}
},
error => {
if (!isDisposed) {
o.error(error)
} else {
log.error(
`Ignoring error for remoteProcedure [${remoteProcedure}] as stream disposed.`,
error
)
}
}
)
const sub = new Subscription()
sub.unsubscribe()
disposables.add(sub)
return disposables
})
示例6: removePreLoader
private removePreLoader() {
if(document) {
let $body = document.body;
let preloader = document.getElementById('preloader');
if(preloader) {
$body.removeChild(preloader);
this.routeEventsSubscription.unsubscribe();
}
$body.classList.remove('loading');
}
}
示例7: setTimeout
setTimeout(() => {
if (value.indexOf("/") !== -1) {
o.next({ noSlashAsync: true });
} else {
o.next(null);
}
// wait for bug update. maybe at final release.
console.log(v);
o.complete();
s.unsubscribe();
}, 1000);
示例8: add
add(teardownSrc: TeardownLogic): Subscription {
let teardown: any = teardownSrc
if (this.closed) return this
if (typeof(teardownSrc) === 'function') teardown = new Subscription(teardown)
if (this.currentSubscription) {
this.remove(this.currentSubscription)
this.currentSubscription.unsubscribe()
this.currentSubscription = null
}
super.add(this.currentSubscription = teardown)
return this
}
示例9: runTasks
runTasks() {
if (this._tasks && this._tasks.isUnsubscribed) {
this._tasks.unsubscribe();
}
this._tasks = Observable.timer(1, 60000)
.concatMap<{errors: string[], config: {[key: string]: string}, appSettings: {[key: string]: string} }>(() =>
Observable.zip(
this._functionsService.getHostErrors().catch(e => Observable.of([])),
this._armService.getConfig(this._globalStateService.FunctionContainer),
this._armService.getFunctionContainerAppSettings(this._globalStateService.FunctionContainer),
(e, c, a) => ({errors: e, config: c, appSettings: a})
)
)
.subscribe(result => {
result.errors.forEach(e => this._broadcastService.broadcast<ErrorEvent>(BroadcastEvent.Error, { message: e, details: `Host Error: ${e}` }));
this.setDisabled(result.config);
this._functionsService.setEasyAuth(result.config);
this._globalStateService.AppSettings = result.appSettings;
this._broadcastService.broadcast(BroadcastEvent.VersionUpdated);
});
}
示例10: ngOnDestroy
ngOnDestroy() {
this.taskListsSubscriptionSubscription.unsubscribe();
if (this.taskListsSubscription != null) {
this.taskListsSubscription.unsubscribe();
}
}