@private
()
| 147 | class 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) { |
nothing calls this directly
no test coverage detected