Completed
Push — master ( c17b81...3a1758 )
by Dimas
19:57 queued 11s
created

libs/js/console.ts   A

Complexity

Total Complexity 5
Complexity/F 0

Size

Lines of Code 31
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 5
mnd 5
bc 5
fnc 0
bpm 0
cpm 0
noi 0
1
interface Console {
2
  olog: {
3
    (...data: any[]): void;
4
    (message?: any, ...optionalParams: any[]): void;
5
  };
6
}
7
declare var console_callback: any;
8
9
if (typeof module == "undefined" && typeof jQuery != "undefined") {
10
  if (typeof console != "undefined")
11
    if (typeof console.log != "undefined") {
12
      console.olog = console.log;
13
    } else {
14
      console.olog = function () {};
15
    }
16
17
  console.log = function (message: string) {
18
    console.olog(message);
19
    if (!$("#debugConsole").length) {
20
      $("body").append('<div id="debugConsole" style="display:none"></div>');
21
    }
22
    if (typeof console_callback == "function") {
23
      console_callback(message);
24
    } else {
25
      $("#debugConsole").append(
26
        "<p> <kbd>" + typeof message + "</kbd> " + message + "</p>"
27
      );
28
    }
29
  };
30
}
31