feat: caching pages

This commit is contained in:
2024-07-07 00:48:54 +05:00
parent 6bad651312
commit 8f5f12ad30
3 changed files with 87 additions and 35 deletions

View File

@@ -5,12 +5,16 @@ import { IRulibChapterResult } from "./parsers/rulib/rulib.chapter.dto";
import { IRulibChaptersResult } from "./parsers/rulib/rulib.chapters.dto";
import { IRulibDetailResult } from "./parsers/rulib/rulib.detail.dto";
import { Datum } from "./parsers/rulib/rulib.search.dto";
import { HttpClient } from "@angular/common/http";
@Injectable({ providedIn: "root" })
export class SearchService {
private itemsTerm = new BehaviorSubject<Datum[]>([]);
currentItemsTerm = this.itemsTerm.asObservable();
constructor(private parser: LibSocialParserService) {}
constructor(
private parser: LibSocialParserService,
private http: HttpClient,
) {}
search(query: string) {
this.parser.searchManga(query).subscribe((data) => {
@@ -45,4 +49,13 @@ export class SearchService {
getImageServer() {
return this.parser.imageServer;
}
getImageData(imageUrl: string): Observable<Uint8Array>{
return this.http.get(imageUrl, {responseType: 'arraybuffer'}).pipe(
map((arrayBuffer: ArrayBuffer) => {
return new Uint8Array(arrayBuffer);
})
);
}
}