Advertisement
MatthijsFontys

Library start

Jan 4th, 2021
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class LightJs {
  2.    
  3.     constructor(){
  4.         this.shouldDebug = true;
  5.         this.q = this.query;
  6.         this.qAll = this.queryAll;
  7.     }
  8.    
  9.     query(selector){
  10.         return document.querySelector(selector);
  11.     }
  12.    
  13.     queryAll(selector){
  14.         return document.querySelectorAll(selector);
  15.     }
  16.    
  17.    
  18.     log(data){
  19.         console.log(`%c Info: ${data}`, 'background: #222; color: #bada55' );
  20.     }
  21.    
  22.     debug(data){
  23.         if(this.shouldDebug){
  24.             console.log(`%c Debug: ${data} `, 'background: #222; color: cyan' );
  25.             if(typeof({}) == typeof(data) && data.length == null){
  26.                 console.log(data);
  27.             }
  28.         }
  29.     }
  30.    
  31. }
  32.  
  33.  
  34. class Light {
  35.     static js(){
  36.         return new LightJs(arguments);
  37.     }
  38. }
  39.  
  40. const l = Light.js();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement