| 20 | | var methods = ['log', 'debug', 'info', 'warn', 'error', 'assert', |
|---|
| 21 | | 'dir', 'dirxml', 'trace', 'group', 'groupEnd', 'time', |
|---|
| 22 | | 'timeEnd', 'profile', 'profileEnd', 'count']; |
|---|
| 23 | | for(var i=0; i<methods.length; ++i) { |
|---|
| 24 | | OpenLayers.Console[methods[i]] = function() {}; |
|---|
| 25 | | } |
|---|
| | 25 | |
|---|
| | 26 | /** |
|---|
| | 27 | * Log an object in the console. The Firebug Lite console logs string |
|---|
| | 28 | * representation of objects. Given multiple arguments, they will |
|---|
| | 29 | * be cast to strings and logged with a space delimiter. If the first |
|---|
| | 30 | * argument is a string with printf-like formatting, subsequent arguments |
|---|
| | 31 | * will be used in string substitution. Any additional arguments (beyond |
|---|
| | 32 | * the number substituted in a format string) will be appended in a space- |
|---|
| | 33 | * delimited line. |
|---|
| | 34 | * |
|---|
| | 35 | * Examples: |
|---|
| | 36 | * // Firebug Lite logs someObject.toString() |
|---|
| | 37 | * OpenLayers.Console.log(someObject); |
|---|
| | 38 | * |
|---|
| | 39 | * // string substitution |
|---|
| | 40 | * OpenLayers.Console.log("%s jumped over %s", cow, moon); |
|---|
| | 41 | * |
|---|
| | 42 | * @param {Object} object |
|---|
| | 43 | */ |
|---|
| | 44 | log: function() {}, |
|---|
| | 45 | |
|---|
| | 46 | /** |
|---|
| | 47 | * Writes a message to the console, including a hyperlink to the line |
|---|
| | 48 | * where it was called. |
|---|
| | 49 | * |
|---|
| | 50 | * May be called with multiple arguments as with OpenLayers.Console.log(). |
|---|
| | 51 | * |
|---|
| | 52 | * @param (Object) object |
|---|
| | 53 | */ |
|---|
| | 54 | debug: function() {}, |
|---|
| | 55 | |
|---|
| | 56 | /** |
|---|
| | 57 | * Writes a message to the console with the visual "info" icon and color |
|---|
| | 58 | * coding and a hyperlink to the line where it was called. |
|---|
| | 59 | * |
|---|
| | 60 | * May be called with multiple arguments as with OpenLayers.Console.log(). |
|---|
| | 61 | * |
|---|
| | 62 | * @param (Object) object |
|---|
| | 63 | */ |
|---|
| | 64 | info: function() {}, |
|---|
| | 65 | |
|---|
| | 66 | /** |
|---|
| | 67 | * Writes a message to the console with the visual "warning" icon and |
|---|
| | 68 | * color coding and a hyperlink to the line where it was called. |
|---|
| | 69 | * |
|---|
| | 70 | * May be called with multiple arguments as with OpenLayers.Console.log(). |
|---|
| | 71 | * |
|---|
| | 72 | * @param (Object) object |
|---|
| | 73 | */ |
|---|
| | 74 | warn: function() {}, |
|---|
| | 75 | |
|---|
| | 76 | /** |
|---|
| | 77 | * Writes a message to the console with the visual "error" icon and color |
|---|
| | 78 | * coding and a hyperlink to the line where it was called. |
|---|
| | 79 | * |
|---|
| | 80 | * May be called with multiple arguments as with OpenLayers.Console.log(). |
|---|
| | 81 | * |
|---|
| | 82 | * @param (Object) object |
|---|
| | 83 | */ |
|---|
| | 84 | error: function() {}, |
|---|
| | 85 | |
|---|
| | 86 | /** |
|---|
| | 87 | * Tests that an expression is true. If not, it will write a message to |
|---|
| | 88 | * the console and throw an exception. |
|---|
| | 89 | * |
|---|
| | 90 | * May be called with multiple arguments as with OpenLayers.Console.log(). |
|---|
| | 91 | * |
|---|
| | 92 | * @param (Object) expression |
|---|
| | 93 | */ |
|---|
| | 94 | assert: function() {}, |
|---|
| | 95 | |
|---|
| | 96 | /** |
|---|
| | 97 | * Prints an interactive listing of all properties of the object. This |
|---|
| | 98 | * looks identical to the view that you would see in the DOM tab. |
|---|
| | 99 | * |
|---|
| | 100 | * @param (Object) object |
|---|
| | 101 | */ |
|---|
| | 102 | dir: function() {}, |
|---|
| | 103 | |
|---|
| | 104 | /** |
|---|
| | 105 | * Prints the XML source tree of an HTML or XML element. This looks |
|---|
| | 106 | * identical to the view that you would see in the HTML tab. You can click |
|---|
| | 107 | * on any node to inspect it in the HTML tab. |
|---|
| | 108 | * |
|---|
| | 109 | * @param (Object) object |
|---|
| | 110 | */ |
|---|
| | 111 | dirxml: function() {}, |
|---|
| | 112 | |
|---|
| | 113 | /** |
|---|
| | 114 | * Prints an interactive stack trace of JavaScript execution at the point |
|---|
| | 115 | * where it is called. The stack trace details the functions on the stack, |
|---|
| | 116 | * as well as the values that were passed as arguments to each function. |
|---|
| | 117 | * You can click each function to take you to its source in the Script tab, |
|---|
| | 118 | * and click each argument value to inspect it in the DOM or HTML tabs. |
|---|
| | 119 | * |
|---|
| | 120 | */ |
|---|
| | 121 | trace: function() {}, |
|---|
| | 122 | |
|---|
| | 123 | /** |
|---|
| | 124 | * Writes a message to the console and opens a nested block to indent all |
|---|
| | 125 | * future messages sent to the console. Call OpenLayers.Console.groupEnd() |
|---|
| | 126 | * to close the block. |
|---|
| | 127 | * |
|---|
| | 128 | * May be called with multiple arguments as with OpenLayers.Console.log(). |
|---|
| | 129 | * |
|---|
| | 130 | * @param (Object) object |
|---|
| | 131 | */ |
|---|
| | 132 | group: function() {}, |
|---|
| | 133 | |
|---|
| | 134 | /** |
|---|
| | 135 | * Closes the most recently opened block created by a call to |
|---|
| | 136 | * OpenLayers.Console.group |
|---|
| | 137 | */ |
|---|
| | 138 | groupEnd: function() {}, |
|---|
| | 139 | |
|---|
| | 140 | /** |
|---|
| | 141 | * Creates a new timer under the given name. Call |
|---|
| | 142 | * OpenLayers.Console.timeEnd(name) |
|---|
| | 143 | * with the same name to stop the timer and print the time elapsed. |
|---|
| | 144 | * |
|---|
| | 145 | * @param {String} name |
|---|
| | 146 | */ |
|---|
| | 147 | time: function() {}, |
|---|
| | 148 | |
|---|
| | 149 | /** |
|---|
| | 150 | * Stops a timer created by a call to OpenLayers.Console.time(name) and |
|---|
| | 151 | * writes the time elapsed. |
|---|
| | 152 | * |
|---|
| | 153 | * @param {String} name |
|---|
| | 154 | */ |
|---|
| | 155 | timeEnd: function() {}, |
|---|
| | 156 | |
|---|
| | 157 | /** |
|---|
| | 158 | * Turns on the JavaScript profiler. The optional argument title would |
|---|
| | 159 | * contain the text to be printed in the header of the profile report. |
|---|
| | 160 | * |
|---|
| | 161 | * This function is not currently implemented in Firebug Lite. |
|---|
| | 162 | * |
|---|
| | 163 | * @param {String} title Optional title for the profiler |
|---|
| | 164 | */ |
|---|
| | 165 | profile: function() {}, |
|---|
| | 166 | |
|---|
| | 167 | /** |
|---|
| | 168 | * Turns off the JavaScript profiler and prints its report. |
|---|
| | 169 | * |
|---|
| | 170 | * This function is not currently implemented in Firebug Lite. |
|---|
| | 171 | */ |
|---|
| | 172 | profileEnd: function() {}, |
|---|
| | 173 | |
|---|
| | 174 | /** |
|---|
| | 175 | * Writes the number of times that the line of code where count was called |
|---|
| | 176 | * was executed. The optional argument title will print a message in |
|---|
| | 177 | * addition to the number of the count. |
|---|
| | 178 | * |
|---|
| | 179 | * This function is not currently implemented in Firebug Lite. |
|---|
| | 180 | * |
|---|
| | 181 | * @param {String} title Optional title to be printed with count |
|---|
| | 182 | */ |
|---|
| | 183 | count: function() {}, |
|---|
| | 184 | |
|---|
| | 185 | /** @final @type String */ |
|---|
| | 186 | CLASS_NAME: "OpenLayers.Console" |
|---|
| | 187 | }; |
|---|
| | 188 | |
|---|
| | 189 | /** |
|---|
| | 190 | * Execute an anonymous function to extend the OpenLayers.Console namespace |
|---|
| | 191 | * if the firebug.js script is included. This closure is used so that the |
|---|
| | 192 | * "scripts" and "i" variables don't pollute the global namespace. |
|---|
| | 193 | */ |
|---|
| | 194 | (function() { |
|---|