Skip to content

Message Passing

Leonardo Riether edited this page Feb 17, 2020 · 1 revision

Message Passing Hell

MPH for short

The browser extension has many .js scripts that run in different contexts, so they need to send messages to each other to communicate. There are currently four distinct execution contexts:

  1. Index aka index.js
  2. Content aka contentScript.js
  3. Background aka background.js
  4. Popup aka popup.js

Overview

These are all of the ways you can send a message in Codeforces++. There's no direct index -> background communication, nor content -> all tabs, etc.

overview

Messages

get storage

  • who sends it: index
  • params: key
  • expected result: { [key]: {...} }

get storage

set storage

  • who sends it: index
  • params: key, value
  • expected result: undefined. It's only there to differentiate between a bg result and an error type

get storage

Clone this wiki locally