Skip to content

Commit

Permalink
style: use finnish notation for observables
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber committed Aug 10, 2022
1 parent f8c98d7 commit d7cffbe
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/app/core/authorization-toggle.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { whenTruthy } from './utils/operators';
exports: [AuthorizationToggleDirective],
})
export class AuthorizationToggleModule {
private static permissions = new ReplaySubject<string[]>(1);
private static permissions$ = new ReplaySubject<string[]>(1);

static forTesting(...permissions: string[]): ModuleWithProviders<AuthorizationToggleModule> {
AuthorizationToggleModule.switchTestingPermissions(...permissions);
Expand All @@ -22,7 +22,7 @@ export class AuthorizationToggleModule {
provide: AuthorizationToggleService,
useValue: {
isAuthorizedTo: (permission: string) =>
AuthorizationToggleModule.permissions.pipe(
AuthorizationToggleModule.permissions$.pipe(
whenTruthy(),
map(perms => checkPermission(perms, permission))
),
Expand All @@ -33,7 +33,7 @@ export class AuthorizationToggleModule {
}

static switchTestingPermissions(...permissions: string[]) {
AuthorizationToggleModule.permissions.next(permissions);
AuthorizationToggleModule.permissions$.next(permissions);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/core/directives/product-context.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ProductContextDirective implements OnInit {
@Output() skuChange = this.context.select('sku');
@Output() quantityChange = this.context.select('quantity');

private propIndex = new ReplaySubject<IdType>(1);
private propIndex$ = new ReplaySubject<IdType>(1);

constructor(@SkipSelf() @Optional() parentContext: ProductContextFacade, private context: ProductContextFacade) {
if (parentContext) {
Expand All @@ -39,7 +39,7 @@ export class ProductContextDirective implements OnInit {
parentContext.connect(
'children',
combineLatest([
this.propIndex.pipe(startWith(undefined), distinctUntilChanged(), pairwise()),
this.propIndex$.pipe(startWith(undefined), distinctUntilChanged(), pairwise()),
this.context.select().pipe(debounceTime(0)),
]),
(parent, [[prevId, currId], context]) => {
Expand Down Expand Up @@ -99,7 +99,7 @@ export class ProductContextDirective implements OnInit {

@Input()
set propagateIndex(index: number | string) {
this.propIndex.next(index);
this.propIndex$.next(index);
}

@Input()
Expand Down
8 changes: 4 additions & 4 deletions src/app/core/feature-toggle.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { FeatureToggleService, checkFeature } from './utils/feature-toggle/featu
exports: [FeatureToggleDirective, NotFeatureToggleDirective],
})
export class FeatureToggleModule {
private static features = new BehaviorSubject<string[]>(undefined);
private static features$ = new BehaviorSubject<string[]>(undefined);

static forTesting(...features: string[]): ModuleWithProviders<FeatureToggleModule> {
FeatureToggleModule.switchTestingFeatures(...features);
Expand All @@ -22,17 +22,17 @@ export class FeatureToggleModule {
provide: FeatureToggleService,
useValue: {
enabled$: (feature: string) =>
FeatureToggleModule.features.pipe(map(toggles => checkFeature(toggles, feature))),
FeatureToggleModule.features$.pipe(map(toggles => checkFeature(toggles, feature))),
// eslint-disable-next-line rxjs/no-subject-value
enabled: (feature: string) => checkFeature(FeatureToggleModule.features.value, feature),
enabled: (feature: string) => checkFeature(FeatureToggleModule.features$.value, feature),
},
},
],
};
}

static switchTestingFeatures(...features: string[]) {
FeatureToggleModule.features.next(features);
FeatureToggleModule.features$.next(features);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/core/role-toggle.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { RoleToggleService, checkRole } from './utils/role-toggle/role-toggle.se
exports: [NotRoleToggleDirective],
})
export class RoleToggleModule {
private static roleIds = new ReplaySubject<string[]>(1);
private static roleIds$ = new ReplaySubject<string[]>(1);

static forTesting(...roleIds: string[]): ModuleWithProviders<RoleToggleModule> {
RoleToggleModule.switchTestingRoles(...roleIds);
Expand All @@ -22,7 +22,7 @@ export class RoleToggleModule {
provide: RoleToggleService,
useValue: {
hasRole: (roleId: string | string[]) =>
RoleToggleModule.roleIds.pipe(
RoleToggleModule.roleIds$.pipe(
whenTruthy(),
map(roles => checkRole(roles, roleId))
),
Expand All @@ -33,7 +33,7 @@ export class RoleToggleModule {
}

static switchTestingRoles(...roleIds: string[]) {
RoleToggleModule.roleIds.next(roleIds);
RoleToggleModule.roleIds$.next(roleIds);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export class ContentIncludeComponent implements OnInit, OnChanges {

contentInclude$: Observable<ContentPageletEntryPointView>;

private includeIdChange = new ReplaySubject<string>(1);
private includeIdChange$ = new ReplaySubject<string>(1);

constructor(private cmsFacade: CMSFacade) {}

ngOnInit() {
this.contentInclude$ = this.cmsFacade.contentInclude$(this.includeIdChange);
this.contentInclude$ = this.cmsFacade.contentInclude$(this.includeIdChange$);
}

ngOnChanges() {
this.includeIdChange.next(this.includeId);
this.includeIdChange$.next(this.includeId);
}
}

0 comments on commit d7cffbe

Please sign in to comment.