MCPcopy Create free account
hub / github.com/mailvelope/mailvelope / init

Method init

src/content-scripts/extractFrame.js:36–53  ·  view source on GitHub ↗
(pgpRange)

Source from the content-addressed store, hash-verified

34 }
35
36 init(pgpRange) {
37 this.pgpRange = pgpRange;
38 // check if wrapper element already exists
39 if (this.pgpRange.commonAncestorContainer.classList.contains('m-extract-wrapper')) {
40 this.pgpElement = this.pgpRange.commonAncestorContainer;
41 } else {
42 // create container element
43 this.pgpElement = document.createElement('div');
44 this.pgpElement.classList.add('m-extract-wrapper');
45 this.pgpElement.style.display = 'inline-block';
46 this.pgpElement.style.position = 'relative';
47 this.pgpElement.append(this.pgpRange.extractContents());
48 this.pgpRange.insertNode(this.pgpElement);
49 this.pgpRange.selectNodeContents(this.pgpElement);
50 }
51 // set status to attached
52 this.pgpElement.dataset[FRAME_STATUS] = FRAME_ATTACHED;
53 }
54
55 establishConnection() {
56 this.port = EventHandler.connect(this.ctrlName, this);

Callers 1

attachToMethod · 0.95

Calls 1

addMethod · 0.80

Tested by

no test coverage detected