Skip to content

Modules

Ethan Huang edited this page Sep 28, 2023 · 4 revisions

Note: This is outdated as of 09-26-2023.

Content Scripts

content.js

Method Description
getFromLocal(key) - An async function that returns something from chrome.storage.local.
- key, the key used to access an object in storage.
instructionHTML() - Dynamically creates a paragraph explaining how to use G-Manager to delete unsubscribed emails.
loadInboxSDK() - An async function that initializes SDK handlers and makes calls to inject components into the Gmail UI.

Background Scripts

EmailService.js

Method Description
parseMessagePart(part) - Returns the decoded html content of the email message or empty string "".
- part, the messagepart defined by the Gmail API.
getUnsubLink(html) - Returns the href url of an HTML element with outerText containing 'unsubscribe' (case-insensitive) or null.
- html, the DOM element form of the text html that was returned by parseMessagePart(part).
getHeaderUnsubLink(headers) - Returns the unsubscription url from an email header or null.
- headers, the list of headers in the email thread.
getSender(headers) - Returns an object containing the name and email stored in the email header.
- headers, the list of headers in the email thread.
extractThreadData(threads) - Parses email threads and decides whether their metadata should be stored in the subscription list.
- threads, the list of email threads that were received by requests to threads.list().
getThreads() - An async function that gathers the list of N threads at a time and extracts their data.

Clone this wiki locally