npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ksengine/photon

v1.0.2

Published

small and lightweight jquery alternaive polyfill

Downloads

9

Readme

:star2: Photon

small and lightweight jquery alternaive

GitHub GitHub issues npm JavaScript Version

| | | | |:-:|:-:|:-:| |Lightweight Footprint|ES5 like|Cross-Browser| |Only npm bundle size. Can also be included as an AMD module|like ECMAScript 2009, also known as ES5, was the first major revision to JavaScript.|Chrome, Edge, Firefox, IE, Safari, Android, iOS, and more|

What is Photon?

Photon is an alternative for jQuery:smile:. Unlike:-1: jQuery, Photon injects:arrow_down_small: some polyfills to built-in javascript objects. Websites can use latest javascript APIs with Photon:+1::+1::+1:. They can work on any modern browser(from Internet Explorer 7):smile:. Photon will handle it from background:+1:. If you want to support older Browsers like Internet Explorer 8, Photon is perfect.

Start using Photon

Compressed:zipper_mouth_face: and uncompressed:open_mouth: copies of Photon files are available. The uncompressed file is best used during development or de:bug:ing(debugging); the compressed file saves bandwidth and improves performance in production. You can also download a sourcemap file for use when de:bug:ging(debugging) with a compressed file. The map file is not required for users to run Photon, it just improves the developer's de:bug:ger(debugger) experience. As of Photon 1.11.0/2.1.0 the //# sourceMappingURL comment is not included in the compressed file.

To locally download these files, right-click:computer_mouse: the link and select "Save as..." from the menu.

Download:arrow_down: and include

Downloading Photon There are two versions of Photon available for downloading:

  • Production version - this is for your live website because it has been minified and compressed
  • Development version - this is for testing and development (uncompressed and readable code) Both versions can be downloaded from here.

The Photon library is a single JavaScript file, and you reference it with the HTML tag (notice that the tag should be inside the section):

  • Production version
<head>
  <script src="Photon.min.js"></script>
</head>
  • Development version
<head>
  <script src="Photon.js"></script>
</head>

Tip: Place the downloaded file in the same directory as the pages where you wish to use it.:exclamation:

Using with a CDN

Photon CDN If you don't want to download and host Photon yourself, you can include it from a CDN (Content Delivery Network).

JSDELIVR CDN

  • Production version
<head>
  <script src="https://cdn.jsdelivr.net/npm/@ksengine/photon/photon.min.js"></script>
</head>
  • Development version
<head>
  <script src="https://cdn.jsdelivr.net/npm/@ksengine/photon/photon.js"></script>
</head>

A Brief Look

Date

The static Date.now() method returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.

console.log( Date.now() );

Ajax example

Call a local script on the server /api/getWeather with the query parameter zipcode=97201 and replace the element #weather-temp's html with the returned text.

var request = new XMLHttpRequest();
request.open('GET', '/api/getWeather', true);

request.onreadystatechange = function() {
  if (this.readyState === 4) {
    if (this.status >= 200 && this.status < 400) {
      // Success!
      document.getElementById( "weather-temp" ).innerHTML = "<strong>" + this.responseText + "</strong> degrees" ;
    } else {
      // Error :(
    }
  }
};

request.send();
request = null;

Supported Features

Photon fixes following features

Ajax

  • [x] XmlHTTPRequest - ajax polyfill(need some more patches)

String - ""

  • [x] String.trim()

Array - []

  • [x] Array.isArray()
  • [x] Array.forEach()
  • [x] Array.map()
  • [x] Array.filter()
  • [x] Array.reduce()
  • [x] Array.reduceRight()
  • [x] Array.every()
  • [x] Array.some()
  • [x] Array.indexOf()
  • [x] Array.lastIndexOf()

JSON - { "id" : 5 } -> '{ "id" : 5 }'

  • [x] JSON.parse()
  • [x] JSON.stringify()

Date - July 20, 69 00:20:18 GMT+00:00

  • [x] Date.now()

  • [ ] "use strict" - (Hope todo)

  • [ ] Property Getters and Setters(Cannot impliment)

  • [ ] New Object Property Methods(TODO)

Star Photon - GitHub Repo stars

Contribute - GitHub Repo forks

<a href="https://icons8.com>icons by Icons8