mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
cache canLaunch result
This commit is contained in:
parent
ff981532fd
commit
4a13e62477
@ -23,6 +23,7 @@ export class LoginUriView implements View {
|
|||||||
private _uri: string;
|
private _uri: string;
|
||||||
private _domain: string;
|
private _domain: string;
|
||||||
private _hostname: string;
|
private _hostname: string;
|
||||||
|
private _canLaunch: boolean;
|
||||||
// tslint:enable
|
// tslint:enable
|
||||||
|
|
||||||
constructor(u?: LoginUri) {
|
constructor(u?: LoginUri) {
|
||||||
@ -39,6 +40,7 @@ export class LoginUriView implements View {
|
|||||||
set uri(value: string) {
|
set uri(value: string) {
|
||||||
this._uri = value;
|
this._uri = value;
|
||||||
this._domain = null;
|
this._domain = null;
|
||||||
|
this._canLaunch = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
get domain(): string {
|
get domain(): string {
|
||||||
@ -72,14 +74,18 @@ export class LoginUriView implements View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get canLaunch(): boolean {
|
get canLaunch(): boolean {
|
||||||
if (this.uri == null) {
|
if (this._canLaunch != null) {
|
||||||
return false;
|
return this._canLaunch;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < CanLaunchWhitelist.length; i++) {
|
if (this.uri != null) {
|
||||||
if (this.uri.indexOf(CanLaunchWhitelist[i]) === 0) {
|
for (let i = 0; i < CanLaunchWhitelist.length; i++) {
|
||||||
return true;
|
if (this.uri.indexOf(CanLaunchWhitelist[i]) === 0) {
|
||||||
|
this._canLaunch = true;
|
||||||
|
return this._canLaunch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
this._canLaunch = false;
|
||||||
|
return this._canLaunch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user