Grammalecte  Check-in [6727222f1a]

Overview
Comment:[doc] Web API update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | doc
Files: files | file ages | folders
SHA3-256: 6727222f1a51ce73af503018faab9e16fa59fb0fb2f287ec2b48c652320a075f
User & Date: olr on 2020-03-19 08:19:34
Other Links: manifest | tags
Context
2020-03-19
08:20
[doc] Web API update check-in: d353472e17 user: olr tags: trunk, doc
08:19
[doc] Web API update check-in: 6727222f1a user: olr tags: trunk, doc
08:10
[doc] Web API update check-in: 6cd37e7067 user: olr tags: trunk, doc
Changes

Modified doc/API_web.md from [a4bf78ddb6] to [c344f75300].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33












34
35
36
37
38
39
40

- get the modified text via events (instead of having the node content directly modified),

- get raw results (list of errors) of grammar checking and spell checking,

- get spelling suggestions for a wrong word.


### Version of the Grammalecte Web API

    oGrammalecteAPI.sVersion


### How it works

Usually, webpage scripts can’t call methods or functions of browser extensions.

The Grammalecte API is injected within your webpage, with methods launching events that Grammalecte is listening. When Grammalecte receives one of these events, it launches the requested tasks. Results may be sent via events on webpage nodes.














### Detecting if Grammalecte API is here

Every call to the Grammalecte API will be done via an object called `oGrammalecteAPI`.

    if (typeof(oGrammalecteAPI) === "object") {







<
<
<
<
<






>
>
>
>
>
>
>
>
>
>
>
>







16
17
18
19
20
21
22





23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

- get the modified text via events (instead of having the node content directly modified),

- get raw results (list of errors) of grammar checking and spell checking,

- get spelling suggestions for a wrong word.







### How it works

Usually, webpage scripts can’t call methods or functions of browser extensions.

The Grammalecte API is injected within your webpage, with methods launching events that Grammalecte is listening. When Grammalecte receives one of these events, it launches the requested tasks. Results may be sent via events on webpage nodes.

For information purpose only, here are the layers of code explaining with you can’t access directly to the grammar checker:

    ·> webpage script
    <> Grammalecte API (injected by the content-script, callable by the webpage script)
    <> Content-script (injected by the extension, not callable by the webpage script)
    <> Background script (extension core)
    <· Worker running the grammar checker on a different process

### Version of the Grammalecte Web API

    oGrammalecteAPI.sVersion


### Detecting if Grammalecte API is here

Every call to the Grammalecte API will be done via an object called `oGrammalecteAPI`.

    if (typeof(oGrammalecteAPI) === "object") {