Browse Source

add eslint

master
John Shaver 1 year ago
parent
commit
3df69322c9
3 changed files with 2 additions and 23 deletions
  1. 1
    3
      hookComponentFactory.js
  2. 1
    3
      pureComponentFactory.js
  3. 0
    17
      test.js

+ 1
- 3
hookComponentFactory.js View File

@@ -4,7 +4,7 @@ import getId from "./id.js";
export function hookComponentFactory(name, propNames, hookRender) {
class ComponentClass extends HTMLElement {
constructor (...args) {
super();
super(...args);
this.attachShadow({mode: 'open'});
this.identifier = getId(name);
this.domRender = hookRender.bind(this);
@@ -22,12 +22,10 @@ export function hookComponentFactory(name, propNames, hookRender) {
this.render(this.parseAttributes())
}
parseAttributes() {
console.log(this);
let attr = {};
for(let i = 0; i < this.attributes.length; ++i) {
attr[this.attributes[i].name] = this.getAttribute(this.attributes[i].name);
}
console.log("Parse attributes: ", attr);
return attr;
}
}

+ 1
- 3
pureComponentFactory.js View File

@@ -3,7 +3,7 @@ import getId from "./id.js";
export function pureComponentFactory (name, propNames, functionalRender) {
class ComponentClass extends HTMLElement {
constructor (...args) {
super();
super(...args);
this.attachShadow({mode: 'open'});
this.identifier = getId(name);
return;
@@ -23,12 +23,10 @@ export function pureComponentFactory (name, propNames, functionalRender) {
this.render(this.parseAttributes())
}
parseAttributes() {
console.log(this);
let attr = {};
for(let i = 0; i < this.attributes.length; ++i) {
attr[this.attributes[i].name] = this.getAttribute(this.attributes[i].name);
}
console.log("Parse attributes: ", attr);
return attr;
}


+ 0
- 17
test.js View File

@@ -1,17 +0,0 @@

let count = pureComponentFactory(
"count-ele",
({count}) => {
console.log("RENDERING COUNT: ", count);
return `<div> <label> count: ${count}</label></div>`
}
);

var buttonPress = function() {
let count = document.querySelector("#count");
let oldValue = parseInt(count.getAttribute('count'))
let newValue = oldValue + 1;
console.log(`OldValue: ${oldValue} NewValue: ${newValue}`);
count.setAttribute('count', newValue.toString());
};


Loading…
Cancel
Save