Adding native encoders (#71)

* Adding browser png

* Adding native JPEG & file size output

* Removing log

* Fixing blob typing

* Fix timing issue
This commit is contained in:
Jake Archibald
2018-07-02 15:14:09 +01:00
committed by GitHub
parent 3f18c927f1
commit a09ec269b8
11 changed files with 14755 additions and 44 deletions

View File

@@ -1,13 +1,20 @@
import * as mozJPEG from './mozjpeg/encoder';
import * as identity from './identity/encoder';
import * as browserPNG from './browser-png/encoder';
import * as browserJPEG from './browser-jpeg/encoder';
export type EncoderState = identity.EncoderState | mozJPEG.EncoderState;
export type EncoderOptions = identity.EncodeOptions | mozJPEG.EncodeOptions;
export type EncoderState =
identity.EncoderState | mozJPEG.EncoderState | browserPNG.EncoderState | browserJPEG.EncoderState;
export type EncoderOptions =
identity.EncodeOptions | mozJPEG.EncodeOptions | browserPNG.EncodeOptions |
browserJPEG.EncodeOptions;
export type EncoderType = keyof typeof encoderMap;
export const encoderMap = {
[identity.type]: identity,
[mozJPEG.type]: mozJPEG,
[browserPNG.type]: browserPNG,
[browserJPEG.type]: browserJPEG,
};
export const encoders = Array.from(Object.values(encoderMap));