View on GitHub

tab-info-extension

Home > tab-info

tab-info package

A chrome extension for surfacing web application metadata more noticably in your browser’s toolbar. see more in the chrome web store

Classes

Class Description
UnreachableError An error class intended for code that should not be reachable acording to constraints that the type system knows about.This is particularly useful when used to implement the “exhaustive switch” or “exhaustive conditional” control flow patterns

Functions

Function Description
assertExists(val, valDescription) Assert whether a value is neither null nor undefined
assertIsMessage(message) Assert whether a given value is not only a MessageBase, but also has a key property of a known message type
assertIsMessageBase(message) Assert whether a value is of type MessageBase.
assertIsPageInfo(arg) Assert whether an unknown value is a PageInfo object
assertIsTabWithId(tab) Assert for the presence of a browser tab’s numeric id property
getPageInfo(documentApi, sendMessage) Create a PageInfo object based on the content of the current tab
guardWithTimeout(promise, timeout) “Wrap” a promise in a timeout, to ensure that it doesn’t “hang” forever in a perpetually pending state.

Interfaces

Interface Description
ContentScriptReadyMessage A message sent from the content script to the background thread to (1) indicate that the content script has loaded and (2) pass the current page info along
FetchRemotePageInfoMessage A message sent *from* the content script *to* the background script asking for pageInfo to be fetched from some API endpoint.
GetPageInfoMessage A message sent *to* the content script by either the background script or popup frame, as a request to respond with a PageInfo value
MessageBase A base class for messages sent between the three actors in this extension (popup, background thread, content script)Each message should have a unique key, so that we can identify them easily and handle them appropriately
MessageMap A mapping of message keys to the types that define their entire shape
PageInfo A wrapper around the TabInfo object that allows us to capture an enabled/disabled state
RemotePageInfoPayload JSON structure provided by a remote tab info information source
TabInfo Information about content rendered within a browser tabThis is provided to the extension’s popup UI, for presentation to the user

Variables

Variable Description
ALL_MESSAGE_KEYS An array of all valid message keys

Type Aliases

Type Alias Description
BackgroundChromeRuntimeOnMessageAPI The subset of the chrome.runtime.onMessage extension API that the background script makes use of
BackgroundPageActionAPI The subset of the chrome.pageAction that the background script makes use of
ContentChromeRuntimeAPI The subset of the chrome.runtime extension API that the content script makes use of
ContentChromeRuntimeOnMessageAPI The subset of the chrome.runtime.onMessage extension API that the content script makes use of
ContentDocumentAPI The subset of the document DOM API that the content script makes use of
Message A type that matches any valid message payload
MessageKey A type that matches any valid message key
TabWithId A browser tab whose id property has already been determined to exist