Grammalecte  Check-in [0c29214964]

Overview
Comment:[core][js] revert modif on helpers (dead branch)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | core | webext | dead
Files: files | file ages | folders
SHA3-256: 0c292149640ea3c4f05d24dbf22a1a4b7de77e5fef341b6ed0ae08e165a9641e
User & Date: olr on 2017-07-29 11:51:51
Original Comment: [core][js] revert modif on helpers
Other Links: branch diff | manifest | tags
Context
2017-07-29
11:51
[core][js] revert modif on helpers (dead branch) Closed-Leaf check-in: 0c29214964 user: olr tags: core, webext, dead
11:35
[core][js] conj as object + some fixes check-in: 37a992d0da user: olr tags: core, webext
Changes

Modified gc_core/js/helpers.js from [33375d9718] to [df207a3682].

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
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";

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.
    _funcOutput: null,

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

    echo: function (obj) {
        if (funcOutput !== null) {
            funcOutput(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 (funcOutput !== null) {
            funcOutput(sMsg);
        if (this._funcOutput !== null) {
            this._funcOutput(sMsg);
        } else {
            console.error(sMsg);
        }
    },

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