OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 [ |
| 6 { |
| 7 "namespace": "experimental.devtools.audits", |
| 8 "nocompile": true, |
| 9 "functions": [ |
| 10 { |
| 11 "name": "addCategory", |
| 12 "type": "function", |
| 13 "description": "Adds an audit category.", |
| 14 "parameters": [ |
| 15 { "name": "displayName", "type": "string", "description": "A display n
ame for the category." }, |
| 16 { "name": "resultCount", "type": "number", "description": "The expecte
d number of audit results in the category." } |
| 17 ], |
| 18 "returns": { |
| 19 "$ref": "AuditCategory" |
| 20 } |
| 21 } |
| 22 ], |
| 23 "types": [ |
| 24 { |
| 25 "id": "AuditCategory", |
| 26 "type": "object", |
| 27 "description": "A group of logically related audit checks.", |
| 28 "events": [ |
| 29 { |
| 30 "name": "onAuditStarted", |
| 31 "type": "function", |
| 32 "description": "If the category is enabled, this event is fired when
the audit is started. The event handler is expected to initiate execution of th
e audit logic that will populate the <code>results</code> collection.", |
| 33 "parameters": [ |
| 34 { "name": "results", "$ref": "AuditResults" } |
| 35 ] |
| 36 } |
| 37 ] |
| 38 }, |
| 39 { |
| 40 "id": "FormattedValue", |
| 41 "type": "object", |
| 42 "additionalProperties": { "type": "any" }, |
| 43 "description": "A value returned from one of the formatters (a URL, code
snippet etc), to be passed to <code>createResult()</code> or <code>addChild()</
code>. See <a href=\"#method-AuditResults-createSnippet\"><code>createSnippet()<
/code></a> and <a href=\"#method-AuditResults-createURL\"><code>createURL()</cod
e></a>." |
| 44 }, |
| 45 { |
| 46 "id": "AuditResults", |
| 47 "type": "object", |
| 48 "description": "A collection of audit results for the current run of the
audit category.", |
| 49 "functions": [ |
| 50 { |
| 51 "name": "addResult", |
| 52 "type": "function", |
| 53 "description": "Adds an audit result. The results are rendered as bu
lleted items under the audit category assoicated with the <code>AuditResults</co
de> object.", |
| 54 "parameters": [ |
| 55 { |
| 56 "name": "displayName", |
| 57 "type": "string", |
| 58 "description": "A concise, high-level description of the result.
" |
| 59 }, |
| 60 { |
| 61 "name": "description", |
| 62 "type": "string", |
| 63 "description": "A detailed description of what the displayName m
eans." |
| 64 }, |
| 65 { |
| 66 "name": "severity", |
| 67 "$ref": "AuditResultSeverity" |
| 68 }, |
| 69 { |
| 70 "name": "details", |
| 71 "$ref": "AuditResultNode", |
| 72 "optional": true, |
| 73 "description": "A subtree that appears under the added result th
at may provide additional details on the violations found." |
| 74 } |
| 75 ] |
| 76 }, |
| 77 { |
| 78 "name": "createResult", |
| 79 "type": "function", |
| 80 "description": "Creates a result node that may be used as the <code>
details</code> parameters to the <code>addResult()</code> method.", |
| 81 "parameters": [ |
| 82 { |
| 83 "name": "content ...", |
| 84 "choices": [ |
| 85 { "type": "string" }, |
| 86 { "$ref": "FormattedValue" } |
| 87 ], |
| 88 "description": "Either string or formatted values returned by on
e of the AuditResult formatters (a URL, a snippet etc). If multiple arguments ar
e passed, these will be concatenated into a single node." |
| 89 } |
| 90 ], |
| 91 "returns": { |
| 92 "$ref": "AuditResultNode" |
| 93 } |
| 94 }, |
| 95 { |
| 96 "name": "done", |
| 97 "type": "function", |
| 98 "description": "Signals the DevTools Audits panel that the run of th
is category is over. The audit run also completes automatically when the number
of added top-level results is equal to that declared when AuditCategory was crea
ted." |
| 99 }, |
| 100 { |
| 101 "name": "createURL", |
| 102 "type": "function", |
| 103 "description": "Render passed value as a URL in the Audits panel.", |
| 104 "parameters": [ |
| 105 { "name": "href", "type": "string", "description": "A URL that app
ears as the href value on the resulting link." }, |
| 106 { "name": "displayText", "type": "string", "description": "Text th
at appears to the user.", "optional": true } |
| 107 ], |
| 108 "returns": { "$ref": "FormattedValue" } |
| 109 }, |
| 110 { |
| 111 "name": "createSnippet", |
| 112 "type": "function", |
| 113 "description": "Render passed text as a code snippet in the Audits p
anel.", |
| 114 "parameters": [ |
| 115 { "name": "text", "type": "string", "description": "Snippet text."
} |
| 116 ], |
| 117 "returns": { "$ref": "FormattedValue" } |
| 118 } |
| 119 ], |
| 120 "properties": { |
| 121 "Severity": { |
| 122 "$ref": "AuditResultSeverity", |
| 123 "description": "A class that contains possible values for the audit
result severities." |
| 124 }, |
| 125 "text": { |
| 126 "type": "string", |
| 127 "description": "The contents of the node." |
| 128 }, |
| 129 "children": { |
| 130 "optional": true, |
| 131 "type": "array", |
| 132 "items": { "$ref": "AuditResultNode" }, |
| 133 "description": "Children of this node." |
| 134 }, |
| 135 "expanded": { |
| 136 "optional": "true", |
| 137 "type": "boolean", |
| 138 "description": "Whether the node is expanded by default." |
| 139 } |
| 140 } |
| 141 }, |
| 142 { |
| 143 "id": "AuditResultNode", |
| 144 "type": "object", |
| 145 "description": "A node in the audit result tree. Displays content and ma
y optionally have children nodes.", |
| 146 "functions": [ |
| 147 { |
| 148 "name": "addChild", |
| 149 "description": "Adds a child node to this node.", |
| 150 "parameters": [ |
| 151 { |
| 152 "name": "content ...", |
| 153 "choices": [ |
| 154 { "type": "string" }, |
| 155 { "$ref": "FormattedValue" } |
| 156 ], |
| 157 "description": "Either string or formatted values returned by on
e of the AuditResult formatters (URL, snippet etc). If multiple arguments are pa
ssed, these will be concatenated into a single node." |
| 158 } |
| 159 ], |
| 160 "returns": { |
| 161 "$ref": "AuditResultNode" |
| 162 } |
| 163 } |
| 164 ], |
| 165 "properties": { |
| 166 "expanded": { |
| 167 "type": "boolean", |
| 168 "description": "If set, the subtree will always be expanded." |
| 169 } |
| 170 } |
| 171 }, |
| 172 { |
| 173 "id": "AuditResultSeverity", |
| 174 "type": "object", |
| 175 "description": "This type contains possible values for a result severity
. The results of different severities are distinguished by colored bullets near
the result's display name.", |
| 176 "properties": { |
| 177 "Info": { |
| 178 "type": "string" |
| 179 }, |
| 180 "Warning": { |
| 181 "type": "string" |
| 182 }, |
| 183 "Severe": { |
| 184 "type": "string" |
| 185 } |
| 186 } |
| 187 } |
| 188 ] |
| 189 } |
| 190 ] |
OLD | NEW |