[ { "namespace": "messageDisplay", "permissions": ["messagesRead"], "events": [ { "name": "onMessageDisplayed", "type": "function", "description": "Fired when a message is displayed, whether in a 3-pane tab, a message tab, or a message window.", "parameters": [ { "name": "tab", "$ref": "tabs.Tab" }, { "name": "message", "$ref": "messages.MessageHeader" } ] }, { "name": "onMessagesDisplayed", "type": "function", "description": "Fired when either a single message is displayed or when multiple messages are displayed, whether in a 3-pane tab, a message tab, or a message window.", "parameters": [ { "name": "tab", "$ref": "tabs.Tab" }, { "name": "messages", "type": "array", "items": { "$ref": "messages.MessageHeader" } } ] } ], "functions": [ { "name": "getDisplayedMessage", "type": "function", "description": "Gets the currently displayed message in the specified tab (even if the tab itself is currently not visible). It returns null if no messages are displayed, or if multiple messages are displayed.", "async": "callback", "parameters": [ { "name": "tabId", "type": "integer", "minimum": 1 }, { "type": "function", "name": "callback", "optional": true, "parameters": [ { "choices": [ { "$ref": "messages.MessageHeader" }, { "type": "null" } ] } ] } ] }, { "name": "getDisplayedMessages", "type": "function", "description": "Gets an array of the currently displayed messages in the specified tab (even if the tab itself is currently not visible). The array is empty if no messages are displayed.", "async": "callback", "parameters": [ { "name": "tabId", "type": "integer", "minimum": 1 }, { "type": "function", "name": "callback", "optional": true, "parameters": [ { "type": "array", "items": { "$ref": "messages.MessageHeader" } } ] } ] }, { "name": "open", "type": "function", "description": "Opens a message in a new tab or in a new window.", "async": "callback", "parameters": [ { "name": "openProperties", "type": "object", "description": "Settings for opening the message. Exactly one of messageId, headerMessageId or file must be specified.", "properties": { "file": { "type": "object", "optional": true, "isInstanceOf": "File", "additionalProperties": true, "description": "The DOM file object of a message to be opened." }, "messageId": { "type": "integer", "optional": true, "minimum": 1, "description": "The id of a message to be opened. Will throw an ExtensionError, if the provided ``messageId`` is unknown or invalid." }, "headerMessageId": { "type": "string", "optional": true, "description": "The headerMessageId of a message to be opened. Will throw an ExtensionError, if the provided ``headerMessageId`` is unknown or invalid. Not supported for external messages." }, "location": { "type": "string", "enum": ["tab", "window"], "optional": true, "description": "Where to open the message. If not specified, the users preference is honoured." }, "active": { "type": "boolean", "optional": true, "description": "Whether the new tab should become the active tab in the window. Only applicable to messages opened in tabs." }, "windowId": { "type": "integer", "minimum": -2, "optional": true, "description": "The id of the window, where the new tab should be created. Defaults to the current window. Only applicable to messages opened in tabs." } } }, { "type": "function", "name": "callback", "parameters": [ { "name": "tab", "$ref": "tabs.Tab" } ] } ] } ] } ]