Grammalecte  Check-in [24cc7b7ca1]

Overview
Comment:[fx] useless to stringify
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext2
Files: files | file ages | folders
SHA3-256: 24cc7b7ca160dd23829d40ed046909aee371c626a2056de67ed9f9cf7067cb4e
User & Date: olr on 2017-08-05 15:39:42
Other Links: branch diff | manifest | tags
Context
2017-08-05
16:01
[fx] test with Nightly again check-in: 578863e008 user: olr tags: fx, webext2
15:39
[fx] useless to stringify check-in: 24cc7b7ca1 user: olr tags: fx, webext2
14:58
[fx] interactions between background and gce_worker check-in: 1611ba0d30 user: olr tags: fx, webext2
Changes

Modified gc_lang/fr/webext/background.js from [004bd27462] to [03c66ef198].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14







-







// Background 

"use strict";

let xGCEWorker = new Worker("gce_worker.js");

xGCEWorker.onmessage = function (e) {
    console.log("Received from Worker:");
    switch (e.data[0]) {
        case "grammar_errors":
            console.log("GRAMMAR ERRORS");
            console.log(e.data[1].aGrammErr);
            break;
        case "spelling_and_grammar_errors":
            console.log("SPELLING AND GRAMMAR ERRORS");

Modified gc_lang/fr/webext/gce_worker.js from [e38688e9b2] to [2ab933f7e3].

126
127
128
129
130
131
132
133

134
135
136
137
138
139

140
141
142
143
144
145
146
126
127
128
129
130
131
132

133
134
135
136
137
138

139
140
141
142
143
144
145
146







-
+





-
+







        console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
        postMessage(["error", e.message]);
    }
}

function parse (sText, sCountry, bDebug, bContext) {
    let aGrammErr = gc_engine.parse(sText, sCountry, bDebug, bContext);
    postMessage(["grammar_errors", {aGrammErr: JSON.stringify(aGrammErr)}]);
    postMessage(["grammar_errors", {aGrammErr: aGrammErr}]);
}

function parseAndSpellcheck (sText, sCountry, bDebug, bContext) {
    let aGrammErr = gc_engine.parse(sText, sCountry, bDebug, bContext);
    let aSpellErr = oTokenizer.getSpellingErrors(sText, oDict);
    postMessage(["spelling_and_grammar_errors", {aGrammErr: JSON.stringify(aGrammErr), aSpellErr: JSON.stringify(aSpellErr)}]);
    postMessage(["spelling_and_grammar_errors", {aGrammErr: aGrammErr, aSpellErr: aSpellErr}]);
}

function getOptions () {
    postMessage(["options", gc_engine.getOptions().gl_toString()]);
}

function getDefaultOptions () {
200
201
202
203
204
205
206
207

208
209
210
211
212
213

214
200
201
202
203
204
205
206

207
208
209
210
211
212

213








-
+





-
+
-
        let aRes = null;
        for (let oToken of oTokenizer.genTokens(sText)) {
            aRes = oLxg.getInfoForToken(oToken);
            if (aRes) {
                aElem.push(aRes);
            }
        }
        postMessage(["tokens", JSON.stringify(aElem)]);
        postMessage(["tokens", aElem]);
    }
    catch (e) {
        helpers.logerror(e);
        postMessage(["error", e.message]);
    }
    
}
}