From 6b459fb08eb979a38c580c18a366baa5050f9518 Mon Sep 17 00:00:00 2001 From: hensm Date: Wed, 30 Oct 2019 07:39:38 +0000 Subject: [PATCH] Add module diagram --- IMPLEMENTATION.md | 6 ++++++ diagram_module.svg | 1 + 2 files changed, 7 insertions(+) create mode 100644 diagram_module.svg diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 3c82ebc..f487395 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -75,6 +75,12 @@ If in background context, the `ShimManager` is imported, initialized and the `po If instead in a content script context, `shim/contentBridge.ts` is imported and with side-effects (background script still calls into ShimManager), it creates and exports a `backgroundPort`. The incoming messages on that port are posted to `port2` and the incoming messages on `port2` are posted to `backgroundPort`. +

+ +

+ In either case, `port1` as part of a message channel to the background script is resolved as the result of the `ensureInit` promise as soon as the `shim:/initialized` message is passed to the shim. diff --git a/diagram_module.svg b/diagram_module.svg new file mode 100644 index 0000000..b736fd7 --- /dev/null +++ b/diagram_module.svg @@ -0,0 +1 @@ +
background context
background context
content script context
<div>content script context</div>
ShimManager
[Not supported by viewer]
shim/export.ts
[Not supported by viewer]
shim/index.ts
[Not supported by viewer]
MessageChannel
[Not supported by viewer]
port1
[Not supported by viewer]
port2
[Not supported by viewer]
eventMessageChannel
<font>eventMessageChannel</font>
createShim
createShim
shim/export.ts
[Not supported by viewer]
thru background
thru background
shim/contentBridge.ts
<div><font>shim/contentBridge.ts</font></div>
MessageChannel
[Not supported by viewer]
port1
[Not supported by viewer]
port2
[Not supported by viewer]
backgroundPort
<font>backgroundPort</font>
ensureInit()
.then(backgroundPort=> {})
[Not supported by viewer]