jsource

A Javascript resource for the everyday coder.

npm install jsource
6 downloads in the last day
82 downloads in the last week
187 downloads in the last month

JSource

A vanilla javascript resource for the everyday developer.

These javascript resources can be used standalone or with one another. They are meant to be vanilla javascript resources that are lightweight and useful. Basically, this is where I write scripts one time only so I can reuse them. These resources are always a result of not being able to find what I need in another script. All too often javascript resources just try to do too much. I typically aim to make these as small and basic as possible. That being said, they are great starting points in a sea of bloated scripts.

Src

  • ajax - Basic XMLHttpRequest handling using Promises
  • Blit - A simple gamecycle engine
  • debounce - The classic debounce pattern
  • Easing - A base set of easing methods
  • EventApi - A basic cross-browser event api
  • Eventful - A singleton event dispatching utility
  • Isearch - Expression matching for term lists
  • KonamiCode - A konami code easter egg handler
  • MatchRoute - A wildcard route matcher
  • MediaBox - An audio and video box manager
  • PushState - A simple history pushState class utility
  • Router - Handles basic GET routing
  • scroll2 - A basic window scroll-to function
  • Stagger - A stepped timeout manager
  • throttle - The classic throttle pattern
  • TouchMe - A lightweight, singleton touch event api
  • Tween - A simple tween class using requestAnimationFrame

Docs

Run the following to jsdoc all the code in the src directory.

# make jsdocs
make jsdocs

# start a server
python -m SimpleHTTPServer

You should be able to see the docs at http://localhost:8000/docs/

Build

You can use grunt to build just a single resource you need. For instance, the Router uses PushState and MatchRoute standalone classes. That's actually the only case where files are broken out and need to be combined. Well, scrollTo uses Tween. Anyway, the following would build Router for you as an example:

# build Router with grunt
grunt build:Router

This distributes to dist/Router.js and dist/Router.min.js.

npm loves you