OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of html; | 5 part of html; |
6 | 6 $ANNOTATIONS |
7 /// @domName $DOMNAME | |
8 class Console { | 7 class Console { |
9 | 8 |
10 static Console safeConsole = new Console(); | 9 static Console safeConsole = new Console(); |
11 | 10 |
12 bool get _isConsoleDefined => JS('bool', "typeof console != 'undefined'"); | 11 bool get _isConsoleDefined => JS('bool', "typeof console != 'undefined'"); |
13 | 12 |
14 /// @domName Console.memory; @docsEditable true | 13 /// @docsEditable true |
| 14 @DomName('Console.memory') |
15 MemoryInfo get memory => _isConsoleDefined ? | 15 MemoryInfo get memory => _isConsoleDefined ? |
16 JS('MemoryInfo', 'console.memory') : null; | 16 JS('MemoryInfo', 'console.memory') : null; |
17 | 17 |
18 /// @domName Console.profiles; @docsEditable true | 18 /// @docsEditable true |
| 19 @DomName('Console.profiles') |
19 List<ScriptProfile> get profiles => _isConsoleDefined ? | 20 List<ScriptProfile> get profiles => _isConsoleDefined ? |
20 JS('List<ScriptProfile>', 'console.profiles') : null; | 21 JS('List<ScriptProfile>', 'console.profiles') : null; |
21 | 22 |
22 /// @domName Console.assertCondition; @docsEditable true | 23 /// @docsEditable true |
| 24 @DomName('Console.assertCondition') |
23 void assertCondition(bool condition, Object arg) => _isConsoleDefined ? | 25 void assertCondition(bool condition, Object arg) => _isConsoleDefined ? |
24 JS('void', 'console.assertCondition(#, #)', condition, arg) : null; | 26 JS('void', 'console.assertCondition(#, #)', condition, arg) : null; |
25 | 27 |
26 /// @domName Console.count; @docsEditable true | 28 /// @docsEditable true |
| 29 @DomName('Console.count') |
27 void count(Object arg) => _isConsoleDefined ? | 30 void count(Object arg) => _isConsoleDefined ? |
28 JS('void', 'console.count(#)', arg) : null; | 31 JS('void', 'console.count(#)', arg) : null; |
29 | 32 |
30 /// @domName Console.debug; @docsEditable true | 33 /// @docsEditable true |
| 34 @DomName('Console.debug') |
31 void debug(Object arg) => _isConsoleDefined ? | 35 void debug(Object arg) => _isConsoleDefined ? |
32 JS('void', 'console.debug(#)', arg) : null; | 36 JS('void', 'console.debug(#)', arg) : null; |
33 | 37 |
34 /// @domName Console.dir; @docsEditable true | 38 /// @docsEditable true |
| 39 @DomName('Console.dir') |
35 void dir(Object arg) => _isConsoleDefined ? | 40 void dir(Object arg) => _isConsoleDefined ? |
36 JS('void', 'console.debug(#)', arg) : null; | 41 JS('void', 'console.debug(#)', arg) : null; |
37 | 42 |
38 /// @domName Console.dirxml; @docsEditable true | 43 /// @docsEditable true |
| 44 @DomName('Console.dirxml') |
39 void dirxml(Object arg) => _isConsoleDefined ? | 45 void dirxml(Object arg) => _isConsoleDefined ? |
40 JS('void', 'console.dirxml(#)', arg) : null; | 46 JS('void', 'console.dirxml(#)', arg) : null; |
41 | 47 |
42 /// @domName Console.error; @docsEditable true | 48 /// @docsEditable true |
| 49 @DomName('Console.error') |
43 void error(Object arg) => _isConsoleDefined ? | 50 void error(Object arg) => _isConsoleDefined ? |
44 JS('void', 'console.error(#)', arg) : null; | 51 JS('void', 'console.error(#)', arg) : null; |
45 | 52 |
46 /// @domName Console.group; @docsEditable true | 53 /// @docsEditable true |
| 54 @DomName('Console.group') |
47 void group(Object arg) => _isConsoleDefined ? | 55 void group(Object arg) => _isConsoleDefined ? |
48 JS('void', 'console.group(#)', arg) : null; | 56 JS('void', 'console.group(#)', arg) : null; |
49 | 57 |
50 /// @domName Console.groupCollapsed; @docsEditable true | 58 /// @docsEditable true |
| 59 @DomName('Console.groupCollapsed') |
51 void groupCollapsed(Object arg) => _isConsoleDefined ? | 60 void groupCollapsed(Object arg) => _isConsoleDefined ? |
52 JS('void', 'console.groupCollapsed(#)', arg) : null; | 61 JS('void', 'console.groupCollapsed(#)', arg) : null; |
53 | 62 |
54 /// @domName Console.groupEnd; @docsEditable true | 63 /// @docsEditable true |
| 64 @DomName('Console.groupEnd') |
55 void groupEnd() => _isConsoleDefined ? | 65 void groupEnd() => _isConsoleDefined ? |
56 JS('void', 'console.groupEnd()') : null; | 66 JS('void', 'console.groupEnd()') : null; |
57 | 67 |
58 /// @domName Console.info; @docsEditable true | 68 /// @docsEditable true |
| 69 @DomName('Console.info') |
59 void info(Object arg) => _isConsoleDefined ? | 70 void info(Object arg) => _isConsoleDefined ? |
60 JS('void', 'console.info(#)', arg) : null; | 71 JS('void', 'console.info(#)', arg) : null; |
61 | 72 |
62 /// @domName Console.log; @docsEditable true | 73 /// @docsEditable true |
| 74 @DomName('Console.log') |
63 void log(Object arg) => _isConsoleDefined ? | 75 void log(Object arg) => _isConsoleDefined ? |
64 JS('void', 'console.log(#)', arg) : null; | 76 JS('void', 'console.log(#)', arg) : null; |
65 | 77 |
66 /// @domName Console.markTimeline; @docsEditable true | 78 /// @docsEditable true |
| 79 @DomName('Console.markTimeline') |
67 void markTimeline(Object arg) => _isConsoleDefined ? | 80 void markTimeline(Object arg) => _isConsoleDefined ? |
68 JS('void', 'console.markTimeline(#)', arg) : null; | 81 JS('void', 'console.markTimeline(#)', arg) : null; |
69 | 82 |
70 /// @domName Console.profile; @docsEditable true | 83 /// @docsEditable true |
| 84 @DomName('Console.profile') |
71 void profile(String title) => _isConsoleDefined ? | 85 void profile(String title) => _isConsoleDefined ? |
72 JS('void', 'console.profile(#)', title) : null; | 86 JS('void', 'console.profile(#)', title) : null; |
73 | 87 |
74 /// @domName Console.profileEnd; @docsEditable true | 88 /// @docsEditable true |
| 89 @DomName('Console.profileEnd') |
75 void profileEnd(String title) => _isConsoleDefined ? | 90 void profileEnd(String title) => _isConsoleDefined ? |
76 JS('void', 'console.profileEnd(#)', title) : null; | 91 JS('void', 'console.profileEnd(#)', title) : null; |
77 | 92 |
78 /// @domName Console.time; @docsEditable true | 93 /// @docsEditable true |
| 94 @DomName('Console.time') |
79 void time(String title) => _isConsoleDefined ? | 95 void time(String title) => _isConsoleDefined ? |
80 JS('void', 'console.time(#)', title) : null; | 96 JS('void', 'console.time(#)', title) : null; |
81 | 97 |
82 /// @domName Console.timeEnd; @docsEditable true | 98 /// @docsEditable true |
| 99 @DomName('Console.timeEnd') |
83 void timeEnd(String title, Object arg) => _isConsoleDefined ? | 100 void timeEnd(String title, Object arg) => _isConsoleDefined ? |
84 JS('void', 'console.timeEnd(#, #)', title, arg) : null; | 101 JS('void', 'console.timeEnd(#, #)', title, arg) : null; |
85 | 102 |
86 /// @domName Console.timeStamp; @docsEditable true | 103 /// @docsEditable true |
| 104 @DomName('Console.timeStamp') |
87 void timeStamp(Object arg) => _isConsoleDefined ? | 105 void timeStamp(Object arg) => _isConsoleDefined ? |
88 JS('void', 'console.timeStamp(#)', arg) : null; | 106 JS('void', 'console.timeStamp(#)', arg) : null; |
89 | 107 |
90 /// @domName Console.trace; @docsEditable true | 108 /// @docsEditable true |
| 109 @DomName('Console.trace') |
91 void trace(Object arg) => _isConsoleDefined ? | 110 void trace(Object arg) => _isConsoleDefined ? |
92 JS('void', 'console.trace(#)', arg) : null; | 111 JS('void', 'console.trace(#)', arg) : null; |
93 | 112 |
94 /// @domName Console.warn; @docsEditable true | 113 /// @docsEditable true |
| 114 @DomName('Console.warn') |
95 void warn(Object arg) => _isConsoleDefined ? | 115 void warn(Object arg) => _isConsoleDefined ? |
96 JS('void', 'console.warn(#)', arg) : null; | 116 JS('void', 'console.warn(#)', arg) : null; |
97 $!MEMBERS | 117 $!MEMBERS |
98 } | 118 } |
OLD | NEW |