Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-supplied algorithms and algorithm enumeration #9

Open
ricea opened this issue Oct 15, 2019 · 2 comments
Open

User-supplied algorithms and algorithm enumeration #9

ricea opened this issue Oct 15, 2019 · 2 comments

Comments

@ricea
Copy link
Collaborator

ricea commented Oct 15, 2019

There should be a way to register algorithms that are not built-in but can be used to construct CompressionStream and DecompressionStreams in the same realm.

@domenic provided the following API sketch:

dictionary TransformStreamInit {
  required ReadableStream readable;
  required WritableStream writable;
};

callback CompressionAlgorithm = Promise<TransformStreamInit> (DOMString format, object options);

interface CompressionAlgorithms {
  maplike<DOMString, CompressionAlgorithm>;
};

partial interface CompressionStream {
  static CompressionAlgorithms algorithms;
};
CompressionStream.algorithms.set(
  "foo",
  () => ({ readable: ..., writable: ... })
);

CompressionStream.algorithms.has('foo');
CompressionStream.algorithms.keys();

Internally, the set of available algorithms would be stored in an internal slot on the global object.

@jimmywarting
Copy link

jimmywarting commented Nov 3, 2020

is this so that you can detect if eg deflate, gzip, deflate-raw, brotli is supported and if not you can add (polyfill) them yourself?

...if so maybe #6 can be closed in favor of this one?

@ricea
Copy link
Collaborator Author

ricea commented Nov 4, 2020

is this so that you can detect if eg deflate, gzip, deflate-raw, brotli is supported and if not you can add (polyfill) them yourself?

Yes.

...if so maybe #6 can be closed in favor of this one?

#6 is for detecting which format a particular object was constructed with. So it's still (mildly) useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants