Definition
Writing Assistance APIs defines Rewriter
[Exposed=Window, SecureContext]
interface Rewriter {
static Promise<Rewriter> create(optional RewriterCreateOptions options = {});
static Promise<Availability> availability(optional RewriterCreateCoreOptions options = {});
Promise<DOMString> rewrite(
DOMString input,
optional RewriterRewriteOptions options = {}
);
ReadableStream rewriteStreaming(
DOMString input,
optional RewriterRewriteOptions options = {}
);
readonly attribute RewriterTone tone;
readonly attribute RewriterFormat format;
readonly attribute RewriterLength length;
readonly attribute FrozenArray<DOMString>? expectedInputLanguages;
readonly attribute FrozenArray<DOMString>? expectedContextLanguages;
readonly attribute DOMString? outputLanguage;
Promise<double> measureInputUsage(
DOMString input,
optional RewriterRewriteOptions options = {}
);
readonly attribute unrestricted double inputQuota;
};
Rewriter includes DestroyableModel;
Consolidated IDL (across mixin and partials)
[Exposed=Window, SecureContext]
interface Rewriter {
static Promise<Rewriter> create(optional RewriterCreateOptions options = {});
static Promise<Availability> availability(optional RewriterCreateCoreOptions options = {});
Promise<DOMString> rewrite(
DOMString input,
optional RewriterRewriteOptions options = {}
);
ReadableStream rewriteStreaming(
DOMString input,
optional RewriterRewriteOptions options = {}
);
readonly attribute RewriterTone tone;
readonly attribute RewriterFormat format;
readonly attribute RewriterLength length;
readonly attribute FrozenArray<DOMString>? expectedInputLanguages;
readonly attribute FrozenArray<DOMString>? expectedContextLanguages;
readonly attribute DOMString? outputLanguage;
Promise<double> measureInputUsage(
DOMString input,
optional RewriterRewriteOptions options = {}
);
readonly attribute unrestricted double inputQuota;
undefined destroy();
};