Grammalecte  Check-in [8820c8ab4d]

Overview
Comment:[core][js] helpers: inspect
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | webext
Files: files | file ages | folders
SHA3-256: 8820c8ab4df1c719fd01476d9fb202a2a2516bcc8acf11192a71513e761979ed
User & Date: olr on 2017-07-29 07:54:15
Other Links: branch diff | manifest | tags
Context
2017-07-29
08:06
[core][js] test if <exports> exists check-in: c55ae247e7 user: olr tags: core, webext
07:54
[core][js] helpers: inspect check-in: 8820c8ab4d user: olr tags: core, webext
2017-07-28
10:17
[fx] other tests... (sigh) check-in: 0053e9898b user: olr tags: fx, webext
Changes

Modified gc_core/js/helpers.js from [4c14caefb4] to [da0905c944].

28
29
30
31
32
33
34









35
36
37
38
39
40
41
    if (funcOutput !== null) {
        funcOutput(sMsg);
    } else {
        console.error(sMsg);
    }
}











// load ressources in workers (suggested by Mozilla extensions reviewers)
// for more options have a look here: https://gist.github.com/Noitidart/ec1e6b9a593ec7e3efed
// if not in workers, use sdk/data.load() instead
function loadFile (spf) {
    try {
        let xRequest;







>
>
>
>
>
>
>
>
>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    if (funcOutput !== null) {
        funcOutput(sMsg);
    } else {
        console.error(sMsg);
    }
}

function inspect (o) {
    let sMsg = "__inspect__: " + typeof o;
    for (let sParam in o) {
        sMsg += "\n" + sParam + ": " + o.sParam;
    }
    sMsg += "\n" + JSON.stringify(o) + "\n__end__";
    echo(sMsg);
}


// load ressources in workers (suggested by Mozilla extensions reviewers)
// for more options have a look here: https://gist.github.com/Noitidart/ec1e6b9a593ec7e3efed
// if not in workers, use sdk/data.load() instead
function loadFile (spf) {
    try {
        let xRequest;
72
73
74
75
76
77
78
79

80
81
82
83
84
85

86
87
88
89
function mapToObject (m) {
    let obj = {};
    for (let [k, v] of m) {
        obj[k] = v;
    }
    return obj;
}


if (typeof(exports) !== 'undefined') {
    // Used for Grammalecte library.
    // In content scripts, these variable are directly reachable
    exports.setLogOutput = setLogOutput;
    exports.echo = echo;
    exports.logerror = logerror;

    exports.loadFile = loadFile;
    exports.objectToMap = objectToMap;
    exports.mapToObject = mapToObject;
}








>

<
<



>




81
82
83
84
85
86
87
88
89
90


91
92
93
94
95
96
97
98
function mapToObject (m) {
    let obj = {};
    for (let [k, v] of m) {
        obj[k] = v;
    }
    return obj;
}


if (typeof(exports) !== 'undefined') {


    exports.setLogOutput = setLogOutput;
    exports.echo = echo;
    exports.logerror = logerror;
    exports.inspect = inspect;
    exports.loadFile = loadFile;
    exports.objectToMap = objectToMap;
    exports.mapToObject = mapToObject;
}