Home - growthboot/Javascript-Q GitHub Wiki

Javascript Q Library (JSQL)

This wiki page is designed to help inform anyone who might be interested in either learning more about the library out of curiosity or to help contribute towards the project. So far there haven't been any contributors besides the creator but the documentation found here was made with as part of an effort to make this library more practical for other developers.

Introdocution

For anyone who has used the library JQuery before they will find many similarities. This is because the JSQL was largely inspired by JQuery and all of its wonderful functionality. With that said, this library is different, isn't a fork of JQuery nor is it a copy on any level. The code for this library has some similarities but was written from the ground up for a different purpose that what JQuery was.

HTML5 popularization

Since 2014 the W3C recommended the adoption of HTML5 into all browsers. Since then the web has changed to be a lot more user friendly. In pre-HTML5 days a library like JQuery was life a saver because it solved major issues that existed in JavaScript as well as solving major cross browser issues and old IE fixes. These issues no longer exist and the number of devices that are in use today that actively browse the web using pre-HTML5 browsers has diminished to an insignificant market share.

The need

Given that HTML5 browsers are so popular now, it is likely no longer necessary for most websites to support very old browsers anymore and developers are no longer trying to. So there are two direct consequences to providing so much unnecessary legacy JavaScript support:

  1. Extra file weight (bandwidth usage, transfer time, memory usage)
  2. Lower performance (extra logic needed to do things) This is all confounded by the fact that most websites today are either fully dependent on HTML5 in more ways than just JavaScript so no matter what the website or app wouldn't work and even if they didn't web developers are usually not testing on technology that is pre-HTML5 anyway.

Added opportunity

By not including so much legacy support in the library the library is 1/100 the size of what it could have been. This has opened the opportunity to solve modern issue with we development that libraries like this one haven't before. Such as things like

  1. A new method of animating things that uses CSS keyframe animations instead of manually iterating the changes.
  2. Added animation capabilities such transforms, GRB colors, box-shadows tweening
  3. Improved queuing for synchronization of animations and delays
  4. If else and loop logic And more...

Principles

  • Only support browsers that are HTML5 compliant.
  • Keep the library weight and memory usage down by not solving unnecessary redundant functionality.
  • Help developers by reducing the amount of code they need to write.
  • Try to make things "Just work" by making the methods of the library is intuitive as possible without sacrificing any of the other principles of the library.
  • Expose as much required functionality needed for the library as public functions accessible directly through the libraries handle ($.rand, $.copy, $.easing, etc...). Why hoard a single resource?
  • Try to solve today's modern issues and make things easier for programmers in new innovative ways.
  • If there is an improvement to the library falls too far out of scope of the purpose and principles of the library, consider adding that new functionality as a plugin.
  • Don't go shorthand crazy, while our goal is to save space, we don't need to go overboard and make things unreadable.
  • Try to eliminate redundant code. There's no need to have two functions that do almost the exact same thing. Make one function the alpha and have the other that are similar call the alpha with the required params.
  • Try to employ the highest performance code without sacrificing any of the other principles of the library.
  • Never duplicate functions for shorthands.