MCPcopy
hub / github.com/mailvelope/mailvelope / connectedCallback

Method connectedCallback

src/client-API/web-components.js:149–165  ·  view source on GitHub ↗

@private

()

Source from the content-addressed store, hash-verified

147class OpenPGPEmailRead extends HTMLElement {
148 /** @private */
149 connectedCallback() {
150 const id = this.getAttribute('id');
151 if (!id) {
152 return this.onError(new Error('Missing id attribute on openpgp-email-read tag. Please add a unique identifier.'));
153 }
154 const [armoredElement] = this.getElementsByClassName('armored');
155 const armored = armoredElement ? armoredElement.textContent : this.dataset.armored;
156 if (!armored) {
157 return this.onError(new Error('Armored message required as <template class="armored"> child element or data-armored attribute.'));
158 }
159 const options = {senderAddress: this.dataset.senderAddress};
160 if (window.mailvelope) {
161 this.createContainer(id, armored, options);
162 } else {
163 window.addEventListener('mailvelope', () => this.createContainer(id, armored, options), {once: true});
164 }
165 }
166
167 /** @private */
168 async createContainer(id, armored, options) {

Callers

nothing calls this directly

Calls 2

onErrorMethod · 0.95
createContainerMethod · 0.95

Tested by

no test coverage detected