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

jschess

v0.2.0

Published

Library includes UI board and Basic Engine validating moves for now.

Downloads

6

Readme

chess-board

chess board is normal js app, but intended to use react like lifesycle, for mounting and updating components. For now only static is board is ready, click event and keystrokes is soon going to add.

The below describes how we are planing, the definition of states are from **w3schools**. Will update on how we do, some flexibitlity is granted.

Mounting Cycle

  • constructor():
    • The constructor() method is called before anything else, when the component is initiated, and it is the natural place to set up the initial state and other initial values.
  • getDerivedStateFromProps() : # we are not using this for now
    • The getDerivedStateFromProps() method is called right before rendering the element(s) in the board. This is the natural place to set the state object based on the initial props. It takes state as an argument, and returns an object with changes to the state.
  • render():
    • The render() method is required, and is the method that actual outputs HTML to the board.
  • componentDidMount():
    • The componentDidMount() method is called after the component is rendered. This is where you run statements that requires that the component is already placed in the board.

Updating Cycle

  • getDerivedStateFromProps() :
    • Also at updates the getDerivedStateFromProps method is called. This is the first method that is called when a component gets updated This is still the natural place to set the state object based on the initial props.
  • shouldComponentUpdate()
    • In the shouldComponentUpdate() method you can return a Boolean value that specifies whether React should continue with the rendering or not. The default value is true. The example below shows what happens when the shouldComponentUpdate() method returns false:
  • render():
    • The render() method is of course called when a component gets updated, it has to re-render the HTML to the board, with the new changes.
  • getSnapshotBeforeUpdate():
    • In the getSnapshotBeforeUpdate() method you have access to the props and state before the update, meaning that even after the update, you can check what the values were before the update. If the getSnapshotBeforeUpdate() method is present, you should also include the componentDidUpdate() method, otherwise you will get an error.
  • componentDidUpdate():
    • The componentDidUpdate method is called after the component is updated in the board.