You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
736 B
TypeScript
32 lines
736 B
TypeScript
import {ChangeDetectionStrategy, Component, Input} from "@angular/core";
|
|
import {shell} from "@tauri-apps/api";
|
|
|
|
@Component({
|
|
selector: "app-external-url",
|
|
templateUrl: "./external-url.component.html",
|
|
styleUrls: ["./external-url.component.scss"],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class ExternalUrlComponent {
|
|
|
|
@Input() href!: string;
|
|
private opening = false;
|
|
|
|
constructor() {
|
|
}
|
|
|
|
public async openUrl() {
|
|
if (this.opening) {
|
|
return;
|
|
}
|
|
this.opening = true;
|
|
try {
|
|
await shell.open(this.href);
|
|
} catch (err) {
|
|
console.error(err);
|
|
} finally {
|
|
this.opening = false;
|
|
}
|
|
}
|
|
}
|