本文整理汇总了TypeScript中rxjs/operators.tap函数的典型用法代码示例。如果您正苦于以下问题:TypeScript tap函数的具体用法?TypeScript tap怎么用?TypeScript tap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tap函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it(`supports font-awesome imports`, (done) => {
host.writeMultipleFiles({
'src/styles.scss': `
$fa-font-path: "~font-awesome/fonts";
@import "~font-awesome/scss/font-awesome";
`,
});
const overrides = { extractCss: true, styles: [`src/styles.scss`] };
runTargetSpec(host, browserTargetSpec, overrides).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
).toPromise().then(done, done.fail);
}, 30000);
开发者ID:rexebin,项目名称:angular-cli,代码行数:14,代码来源:styles_spec_large.ts
示例2: canActivate
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> {
return this.auth.user$.pipe(
take(1),
map(user => ((!user && this.auth.canEdit(user)))),
tap((canEdit: boolean) => {
if (!canEdit) {
console.error('Access denied. Must have permission to EDIT content');
}
})
);
}
开发者ID:Meistercoach83,项目名称:sfw,代码行数:14,代码来源:can-edit.guard.ts
示例3: intercept
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(request).pipe(
tap(
(event: HttpEvent<any>) => {},
(err: any) => {
if (err instanceof HttpErrorResponse) {
if (!(err.status === 401 && (err.message === '' || (err.url && err.url.includes('/api/account'))))) {
this.eventManager.broadcast({ name: 'bestMealApp.httpError', content: err });
}
}
}
)
);
}
开发者ID:jbbfreitas,项目名称:BestMeal,代码行数:14,代码来源:errorhandler.interceptor.ts
示例4: filter
ngxsBootstrap<T>(action: T, results: StatesAndDefaults | undefined): void {
this.internalStateOperations
.getRootStateOperations()
.dispatch(action)
.pipe(
filter(() => !!results),
tap(() => this.invokeInit(results!.states)),
mergeMap(() => this.bootstrapper.appBootstrapped$),
filter(appBootstrapped => !!appBootstrapped)
)
.subscribe(() => {
this.invokeBootstrap(results!.states);
});
}
开发者ID:LucasFrecia,项目名称:store,代码行数:14,代码来源:lifecycle-state-manager.ts
示例5: observe
observe(() => {
const {
job: { id }
} = createUpdateWithSchedule;
return updateJob(id, createUpdateWithSchedule).pipe(
tap(() =>
expect(mockRequest).toHaveBeenLastCalledWith(expect.anything(), {
body: JSON.stringify(createUpdateWithSchedule.schedule),
method: "PUT",
headers: expect.anything()
})
)
);
})
开发者ID:dcos,项目名称:dcos-ui,代码行数:14,代码来源:MetronomeClient-test.ts
示例6: checkStore
checkStore(): Observable<boolean> {
return this.store.select(fromStore.getPizzasLoaded)
.pipe(
tap((loaded) => {
if (!loaded) {
this.store.dispatch(new fromStore.LoadPizzas());
}
}),
filter((loaded) => {
return loaded;
}),
take(1)
)
}
开发者ID:dereklin,项目名称:ngrx-store-effects-app,代码行数:14,代码来源:pizza-exists.guard.ts
示例7: it
it('preserves script order', (done) => {
host.writeMultipleFiles(scripts);
const overrides = { scripts: getScriptsOption() };
runTargetSpec(host, browserTargetSpec, overrides).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => {
const re = new RegExp(
/.*['"]input-script['"](.|\n|\r)*/.source
+ /['"]zinput-script['"](.|\n|\r)*/.source
+ /['"]finput-script['"](.|\n|\r)*/.source
+ /['"]uinput-script['"](.|\n|\r)*/.source
+ /['"]binput-script['"](.|\n|\r)*/.source
+ /['"]ainput-script['"](.|\n|\r)*/.source
+ /['"]cinput-script['"]/.source,
);
const fileName = './dist/scripts.js';
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
expect(content).toMatch(re);
}),
).toPromise().then(done, done.fail);
}, Timeout.Basic);
开发者ID:fmalcher,项目名称:angular-cli,代码行数:23,代码来源:scripts-array_spec_large.ts
示例8: it
it('runs watch mode', (done) => {
const overrides = { watch: true };
runTargetSpec(host, { project: 'app', target: 'server' }, overrides).pipe(
tap((buildEvent) => {
expect(buildEvent.success).toBe(true);
const fileName = join(outputPath, 'main.js');
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
expect(content).toMatch(/AppServerModuleNgFactory/);
}),
take(1),
).subscribe(undefined, done.fail, done);
});
开发者ID:baconwaffles,项目名称:angular-cli,代码行数:14,代码来源:base_spec_large.ts
示例9: canActivate
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<boolean> {
return this.store.select(s => s.environement).pipe(
map(env => env.uid),
map(uid => !!uid),
tap(hasUid => {
if (!hasUid) {
this.router.navigate(['/main/caption']);
}
})
);
}
开发者ID:chgc,项目名称:stream-tools,代码行数:14,代码来源:editable.guard.ts
注:本文中的rxjs/operators.tap函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论