1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-13 19:51:37 +01:00

abstract services

This commit is contained in:
Kyle Spearrin 2018-02-08 12:24:37 -05:00
parent 9cd74af2df
commit 28ed4144db
5 changed files with 20 additions and 19 deletions

View File

@ -1,3 +1,3 @@
export interface MessagingService { export abstract class MessagingService {
send(subscriber: string, arg?: any): void; send: (subscriber: string, arg?: any) => void;
} }

View File

@ -1,6 +1,6 @@
export interface SettingsService { export abstract class SettingsService {
clearCache(): void; clearCache: () => void;
getEquivalentDomains(): Promise<any>; getEquivalentDomains: () => Promise<any>;
setEquivalentDomains(equivalentDomains: string[][]): Promise<any>; setEquivalentDomains: (equivalentDomains: string[][]) => Promise<any>;
clear(userId: string): Promise<void>; clear: (userId: string) => Promise<void>;
} }

View File

@ -1,12 +1,13 @@
export interface UserService { export abstract class UserService {
userId: string; userId: string;
email: string; email: string;
stamp: string; stamp: string;
setUserIdAndEmail(userId: string, email: string): Promise<any>;
setSecurityStamp(stamp: string): Promise<any>; setUserIdAndEmail: (userId: string, email: string) => Promise<any>;
getUserId(): Promise<string>; setSecurityStamp: (stamp: string) => Promise<any>;
getEmail(): Promise<string>; getUserId: () => Promise<string>;
getSecurityStamp(): Promise<string>; getEmail: () => Promise<string>;
clear(): Promise<any>; getSecurityStamp: () => Promise<string>;
isAuthenticated(): Promise<boolean>; clear: () => Promise<any>;
isAuthenticated: () => Promise<boolean>;
} }

View File

@ -1,4 +1,4 @@
import { SettingsService as SettingsServiceInterface } from '../abstractions/settings.service'; import { SettingsService as SettingsServiceAbstraction } from '../abstractions/settings.service';
import { StorageService } from '../abstractions/storage.service'; import { StorageService } from '../abstractions/storage.service';
import { UserService } from '../abstractions/user.service'; import { UserService } from '../abstractions/user.service';
@ -7,7 +7,7 @@ const Keys = {
equivalentDomains: 'equivalentDomains', equivalentDomains: 'equivalentDomains',
}; };
export class SettingsService implements SettingsServiceInterface { export class SettingsService implements SettingsServiceAbstraction {
private settingsCache: any; private settingsCache: any;
constructor(private userService: UserService, private storageService: StorageService) { constructor(private userService: UserService, private storageService: StorageService) {

View File

@ -1,6 +1,6 @@
import { StorageService } from '../abstractions/storage.service'; import { StorageService } from '../abstractions/storage.service';
import { TokenService } from '../abstractions/token.service'; import { TokenService } from '../abstractions/token.service';
import { UserService as UserServiceInterface } from '../abstractions/user.service'; import { UserService as UserServiceAbsrtaction } from '../abstractions/user.service';
const Keys = { const Keys = {
userId: 'userId', userId: 'userId',
@ -8,7 +8,7 @@ const Keys = {
stamp: 'securityStamp', stamp: 'securityStamp',
}; };
export class UserService implements UserServiceInterface { export class UserService implements UserServiceAbsrtaction {
userId: string; userId: string;
email: string; email: string;
stamp: string; stamp: string;