MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / connectedCallback

Method connectedCallback

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

@private

()

Source from the content-addressed store, hash-verified

236class OpenPGPEmailWrite extends HTMLElement {
237 /** @private */
238 connectedCallback() {
239 const id = this.getAttribute('id');
240 if (!id) {
241 return this.onError(new Error('Missing id attribute on openpgp-email-write tag. Please add a unique identifier.'));
242 }
243 const [armoredDraftElement] = this.getElementsByClassName('armored-draft');
244 const armoredDraft = armoredDraftElement ? armoredDraftElement.textContent : undefined;
245 const [quotedMailElement] = this.getElementsByClassName('quoted-mail');
246 const quotedMail = quotedMailElement ? quotedMailElement.textContent : undefined;
247 let {quota, signMsg, keepAttachments} = this.dataset;
248 quota = quota ? Number(quota) : undefined;
249 signMsg = signMsg || signMsg === '' ? true : false;
250 keepAttachments = keepAttachments || keepAttachments === '' ? true : false;
251 const options = {armoredDraft, quotedMail, ...this.dataset, quota, signMsg, keepAttachments};
252 if (window.mailvelope) {
253 this.createEditor(id, options);
254 } else {
255 window.addEventListener('mailvelope', () => this.createEditor(id, options), {once: true});
256 }
257 }
258
259 /** @private */
260 async createEditor(id, options) {

Callers

nothing calls this directly

Calls 2

onErrorMethod · 0.95
createEditorMethod · 0.95

Tested by

no test coverage detected