feat: caching pages
This commit is contained in:
@@ -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);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user