Grammalecte  Diff

Differences From Artifact [df207a3682]:

To Artifact [33375d9718]:


1
2
3
4
5


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

// HELPERS

"use strict";



const helpers = {
    // In Firefox, there is no console.log in PromiseWorker, but there is worker.log.
    // In Thunderbird, you can’t access to console directly. So it’s required to pass a log function.
    _funcOutput: null,

    setLogOutput: function (func) {
        this._funcOutput = func;
    },

    echo: function (obj) {
        if (this._funcOutput !== null) {
            this._funcOutput(obj);
        } else {
            console.log(obj);
        }
        return true;
    },

    logerror: function (e, bStack=false) {
        let sMsg = "\n" + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message;
        if (bStack) {
            sMsg += "\n--- Stack ---\n" + e.stack;
        }
        if (this._funcOutput !== null) {
            this._funcOutput(sMsg);
        } else {
            console.error(sMsg);
        }
    },

    inspect: function (o) {
        let sMsg = "__inspect__: " + typeof o;





>
>



<


|



|
|











|
|







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

// HELPERS

"use strict";

let funcOutput = null;

const helpers = {
    // In Firefox, there is no console.log in PromiseWorker, but there is worker.log.
    // In Thunderbird, you can’t access to console directly. So it’s required to pass a log function.


    setLogOutput: function (func) {
        funcOutput = func;
    },

    echo: function (obj) {
        if (funcOutput !== null) {
            funcOutput(obj);
        } else {
            console.log(obj);
        }
        return true;
    },

    logerror: function (e, bStack=false) {
        let sMsg = "\n" + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message;
        if (bStack) {
            sMsg += "\n--- Stack ---\n" + e.stack;
        }
        if (funcOutput !== null) {
            funcOutput(sMsg);
        } else {
            console.error(sMsg);
        }
    },

    inspect: function (o) {
        let sMsg = "__inspect__: " + typeof o;