|
88 | 88 | "parameters": []
|
89 | 89 | }
|
90 | 90 | ]
|
| 91 | + }, |
| 92 | + { |
| 93 | + "name": "registerContentScripts", |
| 94 | + "type": "function", |
| 95 | + "description": "Registers one or more content scripts for this extension.", |
| 96 | + "async": "callback", |
| 97 | + "parameters": [ |
| 98 | + { |
| 99 | + "name": "scripts", |
| 100 | + "type": "array", |
| 101 | + "description": "Contains a list of scripts to be registered. If there are errors during script parsing/file validation, or if the IDs specified already exist, then no scripts are registered.", |
| 102 | + "items": { |
| 103 | + "$ref": "#/types/RegisteredContentScript" |
| 104 | + } |
| 105 | + }, |
| 106 | + { |
| 107 | + "name": "callback", |
| 108 | + "type": "function", |
| 109 | + "description": "Invoked upon completion of the registration.", |
| 110 | + "parameters": [] |
| 111 | + } |
| 112 | + ] |
| 113 | + }, |
| 114 | + { |
| 115 | + "name": "getRegisteredContentScripts", |
| 116 | + "type": "function", |
| 117 | + "description": "Returns all dynamically registered content scripts for this extension that match the given filter.", |
| 118 | + "async": "callback", |
| 119 | + "parameters": [ |
| 120 | + { |
| 121 | + "allOf": [ |
| 122 | + { |
| 123 | + "$ref": "#/types/ContentScriptFilter" |
| 124 | + }, |
| 125 | + { |
| 126 | + "name": "filter", |
| 127 | + "optional": true, |
| 128 | + "description": "An object to filter the extension's dynamically registered scripts." |
| 129 | + } |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "name": "callback", |
| 134 | + "type": "function", |
| 135 | + "description": "The resulting array contains the registered content scripts.", |
| 136 | + "parameters": [ |
| 137 | + { |
| 138 | + "name": "scripts", |
| 139 | + "type": "array", |
| 140 | + "items": { |
| 141 | + "$ref": "#/types/RegisteredContentScript" |
| 142 | + } |
| 143 | + } |
| 144 | + ] |
| 145 | + } |
| 146 | + ] |
| 147 | + }, |
| 148 | + { |
| 149 | + "name": "unregisterContentScripts", |
| 150 | + "type": "function", |
| 151 | + "description": "Unregisters one or more content scripts for this extension.", |
| 152 | + "async": "callback", |
| 153 | + "parameters": [ |
| 154 | + { |
| 155 | + "allOf": [ |
| 156 | + { |
| 157 | + "$ref": "#/types/ContentScriptFilter" |
| 158 | + }, |
| 159 | + { |
| 160 | + "name": "filter", |
| 161 | + "optional": true, |
| 162 | + "description": "If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered." |
| 163 | + } |
| 164 | + ] |
| 165 | + }, |
| 166 | + { |
| 167 | + "name": "callback", |
| 168 | + "type": "function", |
| 169 | + "description": "Invoked upon completion of the unregistration.", |
| 170 | + "parameters": [] |
| 171 | + } |
| 172 | + ] |
91 | 173 | }
|
92 | 174 | ],
|
93 | 175 | "definitions": {
|
|
236 | 318 | "required": [
|
237 | 319 | "target"
|
238 | 320 | ]
|
| 321 | + }, |
| 322 | + "ContentScriptFilter": { |
| 323 | + "type": "object", |
| 324 | + "properties": { |
| 325 | + "ids": { |
| 326 | + "type": "array", |
| 327 | + "description": "The IDs of specific scripts to retrieve with <code>getRegisteredContentScripts()</code> or to unregister with <code>unregisterContentScripts()</code>.", |
| 328 | + "items": { |
| 329 | + "type": "string" |
| 330 | + } |
| 331 | + } |
| 332 | + } |
| 333 | + }, |
| 334 | + "RegisteredContentScript": { |
| 335 | + "type": "object", |
| 336 | + "properties": { |
| 337 | + "allFrames": { |
| 338 | + "type": "boolean", |
| 339 | + "description": "If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched." |
| 340 | + }, |
| 341 | + "excludeMatches": { |
| 342 | + "type": "array", |
| 343 | + "description": "Excludes pages that this content script would otherwise be injected into.", |
| 344 | + "items": { |
| 345 | + "type": "string" |
| 346 | + } |
| 347 | + }, |
| 348 | + "id": { |
| 349 | + "type": "string", |
| 350 | + "description": "The id of the content script, specified in the API call." |
| 351 | + }, |
| 352 | + "js": { |
| 353 | + "type": "array", |
| 354 | + "description": "The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.", |
| 355 | + "items": { |
| 356 | + "$ref": "manifest#/types/ExtensionURL" |
| 357 | + } |
| 358 | + }, |
| 359 | + "matches": { |
| 360 | + "type": "array", |
| 361 | + "description": "Specifies which pages this content script will be injected into. Must be specified for <code>registerContentScripts()</code>.", |
| 362 | + "items": { |
| 363 | + "type": "string" |
| 364 | + } |
| 365 | + }, |
| 366 | + "runAt": { |
| 367 | + "allOf": [ |
| 368 | + { |
| 369 | + "$ref": "extensionTypes#/types/RunAt" |
| 370 | + }, |
| 371 | + { |
| 372 | + "default": "document_idle", |
| 373 | + "description": "Specifies when JavaScript files are injected into the web page. The preferred and default value is <code>document_idle</code>." |
| 374 | + } |
| 375 | + ] |
| 376 | + } |
| 377 | + }, |
| 378 | + "required": [ |
| 379 | + "id" |
| 380 | + ] |
239 | 381 | }
|
240 | 382 | }
|
241 | 383 | }
|
0 commit comments