Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
evanplaice committed Jun 22, 2020
1 parent 7044043 commit f962dfc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* eslint no-undef: 0 */
class WCInclude extends HTMLElement {
static get observedAttributes () {
return ['src'];
return ['src']
}

attributeChangedCallback (name, oldValue, newValue) {
if (!this.__initialized) { return; }
if (!this.__initialized) { return }
if (oldValue !== newValue) {
this[name] = newValue;
}
}

get src () { return this.getAttribute('src'); }
get src () { return this.getAttribute('src') }
set src (value) {
this.setAttribute('src', value);
this.setSrc();
Expand Down Expand Up @@ -46,7 +46,7 @@ class WCInclude extends HTMLElement {

async fetchSrc (src) {
const response = await fetch(src);
return response.text();
return response.text()
}
}

Expand Down
40 changes: 20 additions & 20 deletions src/wc-include.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
/* eslint no-undef: 0 */
export class WCInclude extends HTMLElement {
static get observedAttributes () {
return ['src'];
return ['src']
}

attributeChangedCallback (name, oldValue, newValue) {
if (!this.__initialized) { return; }
if (!this.__initialized) { return }
if (oldValue !== newValue) {
this[name] = newValue;
this[name] = newValue
}
}

get src () { return this.getAttribute('src'); }
get src () { return this.getAttribute('src') }
set src (value) {
this.setAttribute('src', value);
this.setSrc();
this.setAttribute('src', value)
this.setSrc()
}

constructor () {
super();
this.__initialized = false;
this.__element = null;
const shadow = this.hasAttribute('shadow');
super()
this.__initialized = false
this.__element = null
const shadow = this.hasAttribute('shadow')
if (shadow) {
this.attachShadow({ mode: 'open' });
this.attachShadow({ mode: 'open' })
}

this.__element = shadow
? this.shadowRoot
: this;
: this
}

async connectedCallback () {
if (this.hasAttribute('src')) {
this.setSrc();
this.setSrc()
}
this.__initialized = true;
this.__initialized = true
}

async setSrc () {
const src = this.getAttribute('src');
const contents = await this.fetchSrc(src);
this.__element.innerHTML = contents;
const src = this.getAttribute('src')
const contents = await this.fetchSrc(src)
this.__element.innerHTML = contents
}

async fetchSrc (src) {
const response = await fetch(src);
return response.text();
const response = await fetch(src)
return response.text()
}
}

customElements.define('wc-include', WCInclude);
customElements.define('wc-include', WCInclude)

0 comments on commit f962dfc

Please sign in to comment.