UNPKG

sinon-chrome

Version:

Mock of chrome extensions API for unit testing under nodejs

1,963 lines (1,962 loc) 361 kB
[ { "types": [ { "id": "Alarm", "type": "object", "properties": { "name": { "type": "string" }, "scheduledTime": { "type": "number" }, "periodInMinutes": { "type": "number", "nullable": true } } }, { "id": "AlarmCreateInfo", "type": "object", "properties": { "when": { "type": "number", "nullable": true }, "delayInMinutes": { "type": "number", "nullable": true }, "periodInMinutes": { "type": "number", "nullable": true } } } ], "functions": [ { "name": "create", "type": "function", "parameters": [ { "type": "string", "optional": true, "name": "name" }, { "$ref": "AlarmCreateInfo", "optional": false, "name": "alarmInfo" } ], "static": true }, { "name": "get", "type": "function", "parameters": [ { "type": "string", "optional": true, "name": "name" }, { "optional": false, "name": "callback", "type": "function", "parameters": [ { "$ref": "Alarm", "optional": true, "name": "alarm" } ] } ], "static": true }, { "name": "getAll", "type": "function", "parameters": [ { "optional": false, "name": "callback", "type": "function", "parameters": [ { "type": "array", "items": { "$ref": "Alarm" }, "optional": false, "name": "alarms" } ] } ], "static": true }, { "name": "clear", "type": "function", "parameters": [ { "type": "string", "optional": true, "name": "name" }, { "optional": true, "name": "callback", "type": "function", "parameters": [ { "type": "boolean", "optional": false, "name": "wasCleared" } ] } ], "static": true }, { "name": "clearAll", "type": "function", "parameters": [ { "optional": true, "name": "callback", "type": "function", "parameters": [ { "type": "boolean", "optional": false, "name": "wasCleared" } ] } ], "static": true } ], "events": [ { "name": "onAlarm", "type": "function", "parameters": [ { "$ref": "Alarm", "optional": false, "name": "alarm" } ] } ], "namespace": "alarms", "dependencies": [ "permission:alarms" ] }, { "types": [ { "id": "LaunchItem", "type": "object", "properties": { "entry": { "type": "object" }, "type": { "type": "string", "nullable": true } } }, { "id": "LaunchSource", "type": "string", "enum": [ "untracked", "app_launcher", "new_tab_page", "reload", "restart", "load_and_launch", "command_line", "file_handler", "url_handler", "system_tray", "about_page", "keyboard", "extensions_page", "management_api", "ephemeral_app", "background", "kiosk", "chrome_internal", "test", "installed_notification" ] }, { "id": "ActionType", "type": "string", "enum": [ "new_note" ] }, { "id": "PlayStoreStatus", "type": "string", "enum": [ "enabled", "available", "unknown" ] }, { "id": "ActionData", "type": "object", "properties": { "actionType": { "$ref": "ActionType" } } }, { "id": "LaunchData", "type": "object", "properties": { "id": { "type": "string", "nullable": true }, "items": { "type": "array", "items": { "$ref": "LaunchItem" }, "nullable": true }, "url": { "type": "string", "nullable": true }, "referrerUrl": { "type": "string", "nullable": true }, "isKioskSession": { "type": "boolean", "nullable": true }, "isPublicSession": { "type": "boolean", "nullable": true }, "source": { "$ref": "LaunchSource", "nullable": true }, "actionData": { "$ref": "ActionData", "nullable": true }, "playStoreStatus": { "$ref": "PlayStoreStatus", "nullable": true } } } ], "events": [ { "name": "onEmbedRequested", "type": "function", "parameters": [ { "$ref": "EmbedRequest", "optional": false, "name": "request" } ] }, { "name": "onLaunched", "type": "function", "parameters": [ { "$ref": "LaunchData", "optional": true, "name": "launchData" } ] }, { "name": "onRestarted", "type": "function" } ], "namespace": "app.runtime" }, { "types": [ { "id": "ContentBounds", "type": "object", "properties": { "left": { "type": "integer", "nullable": true }, "top": { "type": "integer", "nullable": true }, "width": { "type": "integer", "nullable": true }, "height": { "type": "integer", "nullable": true } } }, { "id": "BoundsSpecification", "type": "object", "properties": { "left": { "type": "integer", "nullable": true }, "top": { "type": "integer", "nullable": true }, "width": { "type": "integer", "nullable": true }, "height": { "type": "integer", "nullable": true }, "minWidth": { "type": "integer", "nullable": true }, "minHeight": { "type": "integer", "nullable": true }, "maxWidth": { "type": "integer", "nullable": true }, "maxHeight": { "type": "integer", "nullable": true } } }, { "id": "FrameOptions", "type": "object", "properties": { "type": { "type": "string", "nullable": true }, "color": { "type": "string", "nullable": true }, "activeColor": { "type": "string", "nullable": true }, "inactiveColor": { "type": "string", "nullable": true } } }, { "id": "State", "type": "string", "enum": [ "normal", "fullscreen", "maximized", "minimized" ] }, { "id": "WindowType", "type": "string", "enum": [ "shell", "panel" ] }, { "id": "CreateWindowOptions", "type": "object", "properties": { "id": { "type": "string", "nullable": true }, "innerBounds": { "$ref": "BoundsSpecification", "nullable": true }, "outerBounds": { "$ref": "BoundsSpecification", "nullable": true }, "defaultWidth": { "type": "integer", "nullable": true }, "defaultHeight": { "type": "integer", "nullable": true }, "defaultLeft": { "type": "integer", "nullable": true }, "defaultTop": { "type": "integer", "nullable": true }, "width": { "type": "integer", "nullable": true }, "height": { "type": "integer", "nullable": true }, "left": { "type": "integer", "nullable": true }, "top": { "type": "integer", "nullable": true }, "minWidth": { "type": "integer", "nullable": true }, "minHeight": { "type": "integer", "nullable": true }, "maxWidth": { "type": "integer", "nullable": true }, "maxHeight": { "type": "integer", "nullable": true }, "type": { "$ref": "WindowType", "nullable": true }, "ime": { "type": "boolean", "nullable": true }, "showInShelf": { "type": "boolean", "nullable": true }, "icon": { "type": "string", "nullable": true }, "frame": { "$ref": [ { "sequence": false, "generic": null, "nullable": false, "array": false, "union": false, "idlType": "DOMString" }, { "sequence": false, "generic": null, "nullable": false, "array": false, "union": false, "idlType": "FrameOptions" } ], "nullable": true }, "bounds": { "$ref": "ContentBounds", "nullable": true }, "alphaEnabled": { "type": "boolean", "nullable": true }, "state": { "$ref": "State", "nullable": true }, "hidden": { "type": "boolean", "nullable": true }, "resizable": { "type": "boolean", "nullable": true }, "singleton": { "type": "boolean", "nullable": true }, "alwaysOnTop": { "type": "boolean", "nullable": true }, "focused": { "type": "boolean", "nullable": true }, "visibleOnAllWorkspaces": { "type": "boolean", "nullable": true } } } ], "functions": [ { "name": "create", "type": "function", "parameters": [ { "type": "string", "optional": false, "name": "url" }, { "$ref": "CreateWindowOptions", "optional": true, "name": "options" }, { "optional": true, "name": "callback", "type": "function", "parameters": [ { "type": "object", "optional": false, "name": "createdWindow" } ] } ], "static": true }, { "name": "current", "type": "function", "static": true }, { "name": "initializeAppWindow", "type": "function", "parameters": [ { "type": "object", "optional": false, "name": "state" } ], "static": true }, { "name": "getAll", "type": "function", "static": true }, { "name": "get", "type": "function", "parameters": [ { "type": "string", "optional": false, "name": "id" } ], "static": true }, { "name": "canSetVisibleOnAllWorkspaces", "type": "function", "static": true } ], "events": [ { "name": "onBoundsChanged", "type": "function" }, { "name": "onClosed", "type": "function" }, { "name": "onFullscreened", "type": "function" }, { "name": "onMaximized", "type": "function" }, { "name": "onMinimized", "type": "function" }, { "name": "onRestored", "type": "function" }, { "name": "onAlphaEnabledChanged", "type": "function" }, { "name": "onWindowFirstShown", "type": "function" } ], "namespace": "app.window" }, { "types": [ { "id": "VendorIdSource", "type": "string", "enum": [ "bluetooth", "usb" ] }, { "id": "AdapterState", "type": "object", "properties": { "address": { "type": "string" }, "name": { "type": "string" }, "powered": { "type": "boolean" }, "available": { "type": "boolean" }, "discovering": { "type": "boolean" } } }, { "id": "Device", "type": "object", "properties": { "address": { "type": "string" }, "name": { "type": "string", "nullable": true }, "deviceClass": { "type": "integer", "nullable": true }, "vendorIdSource": { "$ref": "VendorIdSource", "nullable": true }, "vendorId": { "type": "integer", "nullable": true }, "productId": { "type": "integer", "nullable": true }, "deviceId": { "type": "integer", "nullable": true }, "type": { "$ref": "DeviceType", "nullable": true }, "paired": { "type": "boolean", "nullable": true }, "connected": { "type": "boolean", "nullable": true }, "connecting": { "type": "boolean", "nullable": true }, "connectable": { "type": "boolean", "nullable": true }, "uuids": { "type": "array", "items": { "type": "string" }, "nullable": true }, "inquiryRssi": { "type": "integer", "nullable": true }, "inquiryTxPower": { "type": "integer", "nullable": true } } } ], "functions": [ { "name": "getAdapterState", "type": "function", "parameters": [ { "optional": false, "name": "callback", "type": "function", "parameters": [ { "$ref": "AdapterState", "optional": false, "name": "adapterInfo" } ] } ], "static": true }, { "name": "getDevice", "type": "function", "parameters": [ { "type": "string", "optional": false, "name": "deviceAddress" }, { "optional": false, "name": "callback", "type": "function", "parameters": [ { "$ref": "Device", "optional": false, "name": "deviceInfo" } ] } ], "static": true }, { "name": "getDevices", "type": "function", "parameters": [ { "optional": false, "name": "callback", "type": "function", "parameters": [ { "type": "array", "items": { "$ref": "Device" }, "optional": false, "name": "deviceInfos" } ] } ], "static": true }, { "name": "startDiscovery", "type": "function", "parameters": [ { "optional": true, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "stopDiscovery", "type": "function", "parameters": [ { "optional": true, "name": "callback", "type": "function", "parameters": [] } ], "static": true } ], "events": [ { "name": "onAdapterStateChanged", "type": "function", "parameters": [ { "$ref": "AdapterState", "optional": false, "name": "state" } ] }, { "name": "onDeviceAdded", "type": "function", "parameters": [ { "$ref": "Device", "optional": false, "name": "device" } ] }, { "name": "onDeviceChanged", "type": "function", "parameters": [ { "$ref": "Device", "optional": false, "name": "device" } ] }, { "name": "onDeviceRemoved", "type": "function", "parameters": [ { "$ref": "Device", "optional": false, "name": "device" } ] } ], "namespace": "bluetooth" }, { "types": [ { "id": "SocketProperties", "type": "object", "properties": { "persistent": { "type": "boolean", "nullable": true }, "name": { "type": "string", "nullable": true }, "bufferSize": { "type": "integer", "nullable": true } } }, { "id": "CreateInfo", "type": "object", "properties": { "socketId": { "type": "integer" } } }, { "id": "ListenOptions", "type": "object", "properties": { "channel": { "type": "integer", "nullable": true }, "psm": { "type": "integer", "nullable": true }, "backlog": { "type": "integer", "nullable": true } } }, { "id": "SocketInfo", "type": "object", "properties": { "socketId": { "type": "integer" }, "persistent": { "type": "boolean" }, "name": { "type": "string", "nullable": true }, "bufferSize": { "type": "integer", "nullable": true }, "paused": { "type": "boolean" }, "connected": { "type": "boolean" }, "address": { "type": "string", "nullable": true }, "uuid": { "type": "string", "nullable": true } } }, { "id": "AcceptInfo", "type": "object", "properties": { "socketId": { "type": "integer" }, "clientSocketId": { "type": "integer" } } }, { "id": "AcceptError", "type": "string", "enum": [ "system_error", "not_listening" ] }, { "id": "AcceptErrorInfo", "type": "object", "properties": { "socketId": { "type": "integer" }, "errorMessage": { "type": "string" }, "error": { "$ref": "AcceptError" } } }, { "id": "ReceiveInfo", "type": "object", "properties": { "socketId": { "type": "integer" }, "data": { "$ref": "ArrayBuffer" } } }, { "id": "ReceiveError", "type": "string", "enum": [ "disconnected", "system_error", "not_connected" ] }, { "id": "ReceiveErrorInfo", "type": "object", "properties": { "socketId": { "type": "integer" }, "errorMessage": { "type": "string" }, "error": { "$ref": "ReceiveError" } } } ], "functions": [ { "name": "create", "type": "function", "parameters": [ { "$ref": "SocketProperties", "optional": true, "name": "properties" }, { "optional": false, "name": "callback", "type": "function", "parameters": [ { "$ref": "CreateInfo", "optional": false, "name": "createInfo" } ] } ], "static": true }, { "name": "update", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "$ref": "SocketProperties", "optional": false, "name": "properties" }, { "optional": true, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "setPaused", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "type": "boolean", "optional": false, "name": "paused" }, { "optional": true, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "listenUsingRfcomm", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "type": "string", "optional": false, "name": "uuid" }, { "$ref": "ListenOptions", "optional": true, "name": "options" }, { "optional": false, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "listenUsingL2cap", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "type": "string", "optional": false, "name": "uuid" }, { "$ref": "ListenOptions", "optional": true, "name": "options" }, { "optional": false, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "connect", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "type": "string", "optional": false, "name": "address" }, { "type": "string", "optional": false, "name": "uuid" }, { "optional": false, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "disconnect", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "optional": true, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "close", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "optional": true, "name": "callback", "type": "function", "parameters": [] } ], "static": true }, { "name": "send", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "$ref": "ArrayBuffer", "optional": false, "name": "data" }, { "optional": true, "name": "callback", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "bytesSent" } ] } ], "static": true }, { "name": "getInfo", "type": "function", "parameters": [ { "type": "integer", "optional": false, "name": "socketId" }, { "optional": false, "name": "callback", "type": "function", "parameters": [ { "$ref": "SocketInfo", "optional": false, "name": "socketInfo" } ] } ], "static": true }, { "name": "getSockets", "type": "function", "parameters": [ { "optional": false, "name": "callback", "type": "function", "parameters": [ { "type": "array", "items": { "$ref": "SocketInfo" }, "optional": false, "name": "sockets" } ] } ], "static": true } ], "events": [ { "name": "onAccept", "type": "function", "parameters": [ { "$ref": "AcceptInfo", "optional": false, "name": "info" } ] }, { "name": "onAcceptError", "type": "function", "parameters": [ { "$ref": "AcceptErrorInfo", "optional": false, "name": "info" } ] }, { "name": "onReceive", "type": "function", "parameters": [ { "$ref": "ReceiveInfo", "optional": false, "name": "info" } ] }, { "name": "onReceiveError", "type": "function", "parameters": [ { "$ref": "ReceiveErrorInfo", "optional": false, "name": "info" } ] } ], "namespace": "bluetoothSocket", "dependencies": [ "manifest:bluetooth" ] }, { "types": [ { "id": "OpenTabOptions", "type": "object", "properties": { "url": { "type": "string" } } } ], "functions": [ { "name": "openTab", "type": "function", "parameters": [ { "$ref": "OpenTabOptions", "optional": false, "name": "options" }, { "optional": true, "name": "callback", "type": "function", "parameters": [] } ], "static": true } ], "namespace": "browser", "dependencies": [ "permission:browser" ] }, { "namespace": "commands", "description": "Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.", "types": [ { "id": "Command", "type": "object", "properties": { "name": { "type": "string", "optional": true, "description": "The name of the Extension Command" }, "description": { "type": "string", "optional": true, "description": "The Extension Command description" }, "shortcut": { "type": "string", "optional": true, "description": "The shortcut active for this command, or blank if not active." } } } ], "events": [ { "name": "onCommand", "description": "Fired when a registered command is activated using a keyboard shortcut.", "type": "function", "parameters": [ { "name": "command", "type": "string" } ] } ], "functions": [ { "name": "getAll", "type": "function", "description": "Returns all the registered extension commands for this extension and their shortcut (if active).", "parameters": [ { "type": "function", "name": "callback", "optional": true, "parameters": [ { "name": "commands", "type": "array", "items": { "$ref": "Command" } } ], "description": "Called to return the registered commands." } ] } ], "dependencies": [ "manifest:commands" ] }, { "namespace": "contextMenus", "description": "Use the <code>chrome.contextMenus</code> API to add items to Google Chrome's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.", "properties": { "ACTION_MENU_TOP_LEVEL_LIMIT": { "value": 6, "description": "The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored." } }, "types": [ { "id": "ContextType", "type": "string", "enum": [ "all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action" ], "description": "The different contexts a menu can appear in. Specifying 'all' is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is only supported by apps and is used to add menu items to the context menu that appears when clicking on the app icon in the launcher/taskbar/dock/etc. Different platforms might put limitations on what is actually supported in a launcher context menu." }, { "id": "ItemType", "type": "string", "enum": [ "normal", "checkbox", "radio", "separator" ], "description": "The type of menu item." } ], "functions": [ { "name": "create", "type": "function", "description": "Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError).", "returns": { "choices": [ { "type": "integer" }, { "type": "string" } ], "description": "The ID of the newly created item." }, "parameters": [ { "type": "object", "name": "createProperties", "properties": { "type": { "$ref": "ItemType", "optional": true, "description": "The type of menu item. Defaults to 'normal' if not specified." }, "id": { "type": "string", "optional": true, "description": "The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension." }, "title": { "type": "string", "optional": true, "description": "The text to be displayed in the item; this is <em>required</em> unless <code>type</code> is 'separator'. When the context is 'selection', you can use <code>%s</code> within the string to show the selected text. For example, if this parameter's value is \"Translate '%s' to Pig Latin\" and the user selects the word \"cool\", the context menu item for the selection is \"Translate 'cool' to Pig Latin\"." }, "checked": { "type": "boolean", "optional": true, "description": "The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items." }, "contexts": { "type": "array", "items": { "$ref": "ContextType" }, "minItems": 1, "optional": true, "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified." }, "onclick": { "type": "function", "optional": true, "description": "A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for chrome.contextMenus.onClicked.", "parameters": [ { "name": "info", "$ref": "contextMenusInternal.OnClickData", "description": "Information about the item clicked and the context where the click happened." }, { "name": "tab", "$ref": "tabs.Tab", "description": "The details of the tab where the click took place. Note: this parameter only present for extensions." } ] }, "parentId": { "choices": [ { "type": "integer" }, { "type": "string" } ], "optional": true, "description": "The ID of a parent menu item; this makes the item a child of a previously added item." }, "documentUrlPatterns": { "type": "array", "items": { "type": "string" }, "optional": true, "description": "Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see <a href='match_patterns'>Match Patterns</a>." }, "targetUrlPatterns": { "type": "array", "items": { "type": "string" }, "optional": true, "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags." }, "enabled": { "type": "boolean", "optional": true, "description": "Whether this context menu item is enabled or disabled. Defaults to true." } } }, { "type": "function", "name": "callback", "optional": true, "description": "Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError.", "parameters": [] } ] }, { "name": "update", "type": "function", "description": "Updates a previously created context menu item.", "parameters": [ { "choices": [ { "type": "integer" }, { "type": "string" } ], "name": "id", "description": "The ID of the item to update." }, { "type": "object", "name": "updateProperties", "description": "The properties to update. Accepts the same values as the create function.", "properties": { "type": { "$ref": "ItemType", "optional": true }, "title": { "type": "string", "optional": true }, "checked": { "type": "boolean", "optional": true }, "contexts": { "type": "array", "items": { "$ref": "ContextType" }, "minItems": 1, "optional": true }, "onclick": { "type": "function", "optional": true, "parameters": [ { "name": "info", "$ref": "contextMenusInternal.OnClickData" }, { "name": "tab", "$ref": "tabs.Tab", "description": "The details of the tab where the click took place. Note: this parameter only present for extensions." } ] }, "parentId": { "choices": [ { "type": "integer" }, { "type": "string" } ], "optional": true, "description": "Note: You cannot change an item to be a child of one of its own descendants." }, "documentUrlPatterns": { "type": "array", "items": { "type": "string" }, "optional": true }, "targetUrlPatterns": { "type": "array", "items": { "type": "string" }, "optional": true }, "enabled": { "type": "boolean", "optional": true } } }, { "type": "function", "name": "callback", "optional": true, "parameters": [], "description": "Called when the context menu has been updated." } ] }, { "name": "remove", "type": "function", "description": "Removes a context menu item.", "parameters": [ { "choices": [ { "type": "integer" }, { "type": "string" } ], "name": "menuItemId", "description": "The ID of the context menu item to remove." }, { "type": "function", "name": "callback", "optional": true, "parameters": [], "description": "Called when the context menu has been removed." } ] }, { "name": "removeAll", "type": "function", "description": "Removes all context menu items added by this extension.", "parameters": [ { "type": "function", "name": "callback", "optional": true, "parameters": [], "description": "Called when removal is complete." } ] } ], "events": [ { "name": "onClicked", "type": "function", "$ref": "contextMenusInternal.onClicked" } ], "dependencies": [ "permission:contextMenus" ] }, { "namespace": "events", "description": "The <code>chrome.events</code> namespace contains common types used by APIs dispatching events to notify you when something interesting happens.", "compiler_options": { "implemented_in": "extensions/browser/api/declarative/declarative_api.h" }, "types": [ { "id": "Rule", "type": "object", "description": "Description of a declarative rule for handling events.", "properties": { "id": { "type": "string", "optional": true, "description": "Optional identifier that allows referencing this rule." }, "tags": { "type": "array", "items": { "type": "string" }, "optional": true, "description": "Tags can be used to annotate rules and perform operations on sets of rules." }, "conditions": { "type": "array", "items": { "type": "any" }, "description": "List of conditions that can trigger the actions." }, "actions": { "type": "array", "items": { "type": "any" }, "description": "List of actions that are triggered if one of the condtions is fulfilled." }, "priority": { "type": "integer", "optional": true, "description": "Optional priority of this rule. Defaults to 100." } } }, { "id": "Event", "type": "object", "description": "An object which allows the addition and removal of listeners for a Chrome event.", "additionalProperties": { "type": "any" }, "functions": [ { "name": "addListener", "nocompile": true, "type": "function", "description": "Registers an event listener <em>callback</em> to an event.", "parameters": [ { "name": "callback", "type": "function", "description": "Called when an event occurs. The parameters of this function depend on the type of event." } ] }, { "name": "removeListener", "nocompile": true, "type": "function", "description": "Deregisters an event listener <em>callback</em> from an event.", "parameters": [ { "name": "callback", "type": "function", "description": "Listener that shall be unregistered." } ] }, { "name": "hasListener", "nocompile": true, "type": "function", "parameters": [ { "name": "callback", "type": "function", "description": "Listener whose registration status shall be tested." } ], "returns": { "type": "boolean", "description": "True if <em>callback</em> is registered to the event." } }, { "name": "hasListeners", "nocompile": true, "type": "function", "parameters": [], "returns": { "type": "boolean", "description": "True if any event listeners are registered to the event." } }, { "name": "addRules", "type": "function", "description": "Registers rules to handle events.", "parameters": [ { "nodoc": "true", "name": "eventName", "type": "string", "description": "Name of the event this function affects." }, { "name": "webViewInstanceId", "type": "integer", "nodoc": true, "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call." }, { "name": "rules", "type": "array", "items": { "$ref": "Rule" }, "description": "Rules to be registered. These do not replace previously registered rules." }, { "name": "callback", "optional": true, "type": "function", "parameters": [ { "name": "rules", "type": "array", "items": { "$ref": "Rule" }, "description": "Rules that were registered, the optional parameters are filled with values." } ], "description": "Called with registered rules." } ] }, { "name": "getRules", "type": "function", "description": "Returns currently registered rules.", "parameters": [ { "nodoc": "true", "name": "eventName", "type": "string", "description": "Name of the event this function affects." }, { "name": "webViewInstanceId", "type": "integer", "nodoc": true, "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call." }, { "name": "ruleIdentifiers", "optional": true, "type": "array", "items": { "type": "string" }, "description": "If an array is passed, only rules with identifiers contained in this array are returned." }, { "name": "callback", "type": "function", "parameters": [ { "name": "rules", "type": "array", "items": { "$ref": "Rule" }, "description": "Rules that were registered, the optional parameters are filled with values." } ], "description": "Called with registered rules." }