Skip to content

Fix minor issues with the code samples and the IDL #13

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ When there are multiple languages in the proofreading input, developers could sp
const proofreader = await Proofreader.create({
includeCorrectionTypes: true,
expectedInputLanguages: ["en", "ja"],
})
});
```

### Testing available options before creation
Expand Down Expand Up @@ -148,7 +148,7 @@ const proofreader = await Proofreader.create({
console.log(`Downloaded ${e.loaded * 100}%`);
});
}
};
});
```

If the download fails, then `downloadprogress` events will stop being fired, and the promise returned by `create()` will be rejected with a "`NetworkError`" `DOMException`.
Expand Down Expand Up @@ -177,15 +177,13 @@ Allowing such destruction provides a way to free up the memory used by the langu

Aborting the creation process will reject the promise returned by `create()`, and will also stop signaling any ongoing download progress. (The browser may then abort the downloads, or may continue them. Either way, no further `downloadprogress` events will be fired.)



## Detailed design discussion

### Proofreading correction output

For each input, the method `proofread()` returns a promise of `ProofreadResult`:

```js
```idl
dictionary ProofreadResult {
DOMString corrected;
sequence<ProofreadCorrection> corrections;
Expand All @@ -194,7 +192,7 @@ dictionary ProofreadResult {

`corrected` is the fully corrected version of the input, while `corrections` contains a list of corrections made, their locations in the original input (e.g. so web developers can create UI to highlight the error), and optionally labels/explanations.

```js
```idl
dictionary ProofreadCorrection {
unsigned long long startIndex;
unsigned long long endIndex;
Expand Down Expand Up @@ -241,7 +239,7 @@ if (inputRenderIndex !== input.length){
```

### Full API surface in Web IDL
```js
```idl
[Exposed=(Window,Worker), SecureContext]
interface Proofreader {
static Promise<Proofreader> create(optional ProofreaderCreateOptions options = {});
Expand Down