Browse Source

add eslint

master
John Shaver 8 months 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";
4 4
 export function hookComponentFactory(name, propNames, hookRender) {
5 5
   class ComponentClass extends HTMLElement {
6 6
     constructor (...args) {
7
-      super();
7
+      super(...args);
8 8
       this.attachShadow({mode: 'open'});
9 9
       this.identifier = getId(name);
10 10
       this.domRender = hookRender.bind(this);
@@ -22,12 +22,10 @@ export function hookComponentFactory(name, propNames, hookRender) {
22 22
       this.render(this.parseAttributes())
23 23
     }
24 24
     parseAttributes() {
25
-      console.log(this);
26 25
       let attr = {};
27 26
       for(let i = 0; i < this.attributes.length; ++i) {
28 27
         attr[this.attributes[i].name] = this.getAttribute(this.attributes[i].name); 
29 28
       }
30
-      console.log("Parse attributes: ", attr);
31 29
       return attr;
32 30
     }
33 31
   }

+ 1
- 3
pureComponentFactory.js View File

@@ -3,7 +3,7 @@ import getId from "./id.js";
3 3
 export function pureComponentFactory (name, propNames, functionalRender) {
4 4
   class ComponentClass extends HTMLElement  {
5 5
     constructor (...args) {
6
-      super();
6
+      super(...args);
7 7
       this.attachShadow({mode: 'open'});
8 8
       this.identifier = getId(name);
9 9
       return;
@@ -23,12 +23,10 @@ export function pureComponentFactory (name, propNames, functionalRender) {
23 23
       this.render(this.parseAttributes())
24 24
     }
25 25
     parseAttributes() {
26
-      console.log(this);
27 26
       let attr = {};
28 27
       for(let i = 0; i < this.attributes.length; ++i) {
29 28
         attr[this.attributes[i].name] = this.getAttribute(this.attributes[i].name); 
30 29
       }
31
-      console.log("Parse attributes: ", attr);
32 30
       return attr;
33 31
     }
34 32
 

+ 0
- 17
test.js View File

@@ -1,17 +0,0 @@
1
-
2
-let count = pureComponentFactory(
3
-  "count-ele",
4
-  ({count}) => {
5
-    console.log("RENDERING COUNT: ", count);
6
-    return `<div> <label> count: ${count}</label></div>`
7
-  }
8
-);
9
-
10
-var buttonPress = function() {
11
-  let count = document.querySelector("#count");
12
-  let oldValue =  parseInt(count.getAttribute('count'))
13
-  let newValue =  oldValue + 1;
14
-  console.log(`OldValue: ${oldValue} NewValue: ${newValue}`);
15
-  count.setAttribute('count', newValue.toString());
16
-};
17
-

Loading…
Cancel
Save