mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-17 19:19:47 +00:00
Adressing smaller review comments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { canDecode, fileToBitmap } from '../../lib/util';
|
||||
import { canDecodeImage, fileToBitmap } from '../../lib/util';
|
||||
|
||||
export const name = 'Browser JPEG Decoder';
|
||||
export const supportedExtensions = ['jpg', 'jpeg'];
|
||||
@@ -11,5 +11,5 @@ export async function decode(file: File): Promise<ImageBitmap> {
|
||||
const jpegFile = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AJVAA//Z';
|
||||
|
||||
export function isSupported(): Promise<boolean> {
|
||||
return canDecode(jpegFile);
|
||||
return canDecodeImage(jpegFile);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { canDecode, fileToBitmap } from '../../lib/util';
|
||||
import { canDecodeImage, fileToBitmap } from '../../lib/util';
|
||||
|
||||
export const name = 'Browser PNG Decoder';
|
||||
export const supportedExtensions = ['png'];
|
||||
@@ -11,5 +11,5 @@ export async function decode(file: File): Promise<ImageBitmap> {
|
||||
const pngFile = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=';
|
||||
|
||||
export function isSupported(): Promise<boolean> {
|
||||
return canDecode(pngFile);
|
||||
return canDecodeImage(pngFile);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { canDecode, fileToBitmap } from '../../lib/util';
|
||||
import { canDecodeImage, fileToBitmap } from '../../lib/util';
|
||||
|
||||
export const name = 'Browser WebP Decoder';
|
||||
export const supportedExtensions = ['webp'];
|
||||
@@ -11,5 +11,5 @@ export async function decode(file: File): Promise<ImageBitmap> {
|
||||
const webpFile = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=';
|
||||
|
||||
export function isSupported(): Promise<boolean> {
|
||||
return canDecode(webpFile);
|
||||
return canDecodeImage(webpFile);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export default class WebpDecoder {
|
||||
},
|
||||
onRuntimeInitialized() {
|
||||
// An Emscripten is a then-able that, for some reason, `then()`s itself,
|
||||
// causing an infite loop when you wrap it in a real promise. Deleten the `then`
|
||||
// causing an infite loop when you wrap it in a real promise. Deleting the `then`
|
||||
// prop solves this for now.
|
||||
// See: https://github.com/kripken/emscripten/blob/incoming/src/postamble.js#L129
|
||||
// TODO(surma@): File a bug with Emscripten on this.
|
||||
|
||||
@@ -11,6 +11,5 @@ export async function decode(file: File): Promise<ImageBitmap> {
|
||||
}
|
||||
|
||||
export async function isSupported(): Promise<boolean> {
|
||||
// TODO(@surma): Should we do wasm detection here or something?
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user